Skip to content

cmd/syncthing: set charset=utf-8 on migration API Content-Type (fixes #10499)#10648

Closed
harshitanand wants to merge 1 commit into
syncthing:mainfrom
harshitanand:fix/issue-10499-migration-api-content-type
Closed

cmd/syncthing: set charset=utf-8 on migration API Content-Type (fixes #10499)#10648
harshitanand wants to merge 1 commit into
syncthing:mainfrom
harshitanand:fix/issue-10499-migration-api-content-type

Conversation

@harshitanand
Copy link
Copy Markdown

Linked Issue

Closes #10499

Description

The migratingAPI handler in cmd/syncthing/main.go set a bare text/plain Content-Type header. Per RFC 2046, omitting the charset parameter implies US-ASCII. Syncthing log output may contain non-US-ASCII characters (e.g. Unicode in log messages), so the header should explicitly declare UTF-8.

Fix: Change "text/plain" to "text/plain; charset=utf-8" in migratingAPI.Serve(). This is consistent with the regular API's /rest/system/log.txt endpoint (lib/api/api.go:1106) which already uses the correct value.

Changes

  • cmd/syncthing/main.go: 1 character-set qualifier added to Content-Type string

Type of Change

  • Bug fix (non-breaking)

Testing

  • go test ./cmd/syncthing/... — 4 passed, 0 failed (using -tags noassets for local env)
  • go build ./cmd/syncthing/ — clean (pre-existing auto.Assets env constraint unrelated to this fix)

…yncthing#10499)

The migratingAPI handler set a bare "text/plain" Content-Type header,
which per RFC 2046 implies US-ASCII. Syncthing log output may contain
non-US-ASCII characters, so the header should explicitly declare UTF-8
to match the actual encoding used.

Signed-off-by: Harshit Anand <harshitanand@users.noreply.github.com>
@calmh calmh mentioned this pull request Apr 22, 2026
@calmh calmh closed this in #10650 Apr 22, 2026
pull Bot pushed a commit to dudw/syncthing that referenced this pull request Apr 22, 2026
... which keep getting filed by AI agents.

Closes syncthing#10649, closes syncthing#10486, closes syncthing#10648, closes syncthing#10499, closes
syncthing#10647, closes syncthing#10635, closes syncthing#10636, closes syncthing#10607.

---------

Signed-off-by: Jakob Borg <jakob@kastelo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database migration temporary API sometimes uses a US-ASCII Content-Type with non-US-ASCII data

1 participant