forgejo/routers/web
Giteabot b272224918
Preserve BOM in web editor (#28935) (#28959)
Backport #28935 by @silverwind

The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
in UTF8, so the stripping must be optional depending on use case. This
does:

- Add a options struct to all `ToUTF8*` functions, that by default will
strip BOM to preserve existing behaviour
- Remove `ToUTF8` function, it was dead code
- Rename `ToUTF8WithErr` to `ToUTF8`
- Preserve BOM in Monaco Editor
- Remove a unnecessary newline in the textarea value. Browsers did
ignore it, it seems but it's better not to rely on this behaviour.

Fixes: https://github.com/go-gitea/gitea/issues/28743
Related: https://github.com/go-gitea/gitea/issues/6716 which seems to
have once introduced a mechanism that strips and re-adds the BOM, but
from what I can tell, this mechanism was removed at some point after
that PR.

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit b8e6cffd31)
2024-01-31 14:18:26 +01:00
..
admin Forbid removing the last admin user (#28337) (#28793) 2024-01-16 14:41:11 +00:00
auth [GITEA] rework long-term authentication 2024-01-16 14:14:46 +00:00
devtest
events
explore Next round of db.DefaultContext refactor (#27089) 2023-09-16 14:39:12 +00:00
feed Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
healthcheck [BRANDING] cosmetic s/Gitea/Forgejo/ in logs, messages, etc. 2023-11-13 13:58:17 +01:00
misc Refactor CORS handler (#28587) (#28611) 2024-01-16 14:08:38 +00:00
org Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
repo Preserve BOM in web editor (#28935) (#28959) 2024-01-31 14:18:26 +01:00
shared Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
user [GITEA] Fix NPE in UsernameSubRoute 2024-01-18 15:31:04 +01:00
base.go Fix panic in storageHandler (#27446) (#27479) 2023-10-06 16:51:26 +02:00
githttp.go Refactor CORS handler (#28587) (#28611) 2024-01-16 14:08:38 +00:00
goget.go
home.go [GITEA] rework long-term authentication 2024-01-16 14:14:46 +00:00
metrics.go
nodeinfo.go
swagger_json.go Start using template context function (#26254) 2023-08-08 01:22:47 +00:00
web.go [GITEA] rework long-term authentication 2024-01-16 14:14:46 +00:00
webfinger.go Add a link to OpenID Issuer URL in WebFinger response (#26000) 2023-07-20 16:02:45 +08:00