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
- Create an issue or an issue comment.
- Prepare a long Japanese body, for example repeating
日本語更新テスト many times.
- Update the existing issue or issue comment with
PATCH and Content-Type: application/json.
- 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
Summary
Updating an existing issue or issue comment with
PATCH+application/jsoncan corrupt long UTF-8 Japanese text on Gitea1.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
POSTwithapplication/jsonPATCHwithapplication/x-www-form-urlencodedWhat breaks
PATCHwithapplication/jsonReproduction
日本語更新テストmany times.PATCHandContent-Type: application/json.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
1.25.5instance.application/x-www-form-urlencoded.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