mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-09 17:37:20 -06:00
When a file, README or wiki page is rendered as markup, the HTML is read through a 32 KiB buffer to escape invisible and ambiguous characters. A multi-byte character cut by that buffer right after a tag was shown as broken characters, e.g. `<p>보기</p>` became `<p>���기</p>`. Such a part is now kept for the next read. Two related cases are fixed as well: - Invalid bytes right before a tag are marked as broken instead of passing through raw as part of the tag. - A BOM split across reads is kept instead of being escaped as invisible. To reproduce, view a Markdown file with 32734 `A` characters, a blank line and `보기`, which puts `보` across the first 32 KiB of the rendered HTML: [split-rune-after-tag.md](https://github.com/user-attachments/files/34361104/split-rune-after-tag.md) https://github.com/go-gitea/gitea/pull/39937 replaces this reader with a single in-memory pass. This small fix can be backported to the release branches. Assisted-by: Claude Code:claude-opus-5-5 ---- | Before (2ed6a6f61b) | After (2a1d09755f) | | --- | --- | |  |  | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>