Skip to content

PATCH(JSON) corrupts long UTF-8 Japanese text for issues and issue comments on v1.25.5 #37211

@codemafia0000

Description

@codemafia0000

Summary

Updating an existing issue or issue comment with PATCH + application/json can corrupt long UTF-8 Japanese text on Gitea 1.25.5.

I reproduced this on:

  • PATCH /api/v1/repos/{owner}/{repo}/issues/{index}
  • PATCH /api/v1/repos/{owner}/{repo}/issues/comments/{id}

What works

  • POST with application/json
  • PATCH with application/x-www-form-urlencoded

What breaks

  • PATCH with application/json

Reproduction

  1. Create an issue or an issue comment.
  2. Prepare a long Japanese body, for example repeating 日本語更新テスト many times.
  3. Update the existing issue or issue comment with PATCH and Content-Type: application/json.
  4. Read it back from the API or DB.

Expected

The updated body should preserve the UTF-8 Japanese text exactly.

Actual

Some characters are corrupted and become replacement characters like ��� / U+FFFD.

Additional notes

  • I could reproduce this on a local Gitea 1.25.5 instance.
  • I could not reproduce corruption when sending the same update as application/x-www-form-urlencoded.
  • I also could not reproduce corruption when creating a new comment with POST + application/json.

Gitea Version

1.25.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.35.1

Operating System

macOS 14.5

How are you running Gitea?

Running a local Gitea instance from a command-line binary on macOS 14.5.
Gitea version: 1.25.5
Git version: 2.35.1
The issue was reproduced against a local instance, not on demo.gitea.com.

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions