Skip to content

Fix profile JSON import broken by trailing newline#3244

Open
trulyliu wants to merge 1 commit into
shadowsocks:masterfrom
trulyliu:master
Open

Fix profile JSON import broken by trailing newline#3244
trulyliu wants to merge 1 commit into
shadowsocks:masterfrom
trulyliu:master

Conversation

@trulyliu

@trulyliu trulyliu commented May 8, 2026

Copy link
Copy Markdown

The gson→org.json migration in df4d65c wrapped the root-value read in while (JSONTokener.more()) process(nextValue()), but JSONTokener.more() reports true on trailing whitespace. Every JSON file ending with a newline (i.e. essentially every file) hits a second nextValue() call that runs off the end and throws JSONException, before finalize() persists the parsed profile.

Restore the pre-migration single-value semantic.

The gson→org.json migration in df4d65c wrapped the root-value
read in `while (JSONTokener.more()) process(nextValue())`, but
JSONTokener.more() reports true on trailing whitespace. Every
JSON file ending with a newline (i.e. essentially every file)
hits a second nextValue() call that runs off the end and throws
JSONException, before finalize() persists the parsed profile.

Restore the pre-migration single-value semantic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trulyliu

trulyliu commented May 8, 2026

Copy link
Copy Markdown
Author

This PR fixes a bug in the latest version that prevents the import of JSON configuration files on TV.

@Mygod Mygod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the functionality.

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.

2 participants