Skip to content

Conversation

@alperozturk96
Copy link
Contributor

@alperozturk96 alperozturk96 commented Oct 23, 2025

Issue

Some responses can be completely empty: either entirely \u0000 (null characters) or just whitespace. Passing to the Gson.fromJson() causing JSON parsing exceptions.

Needed for: nextcloud/notes-android#2883

Changes

Before attempting deserialization, the isReaderContainsEmptyResponse peeks at the first 64 characters. If all characters are either: \u0000 (null characters) or whitespace (' ', '\t', '\n', '\r') then the stream is considered “empty” or “ignorable.”

Invalid Reader Valid Reader
before after

Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
@alperozturk96 alperozturk96 added 2. developing Work in progress don't merge and removed 3. to review Waiting for reviews labels Oct 23, 2025
Signed-off-by: alperozturk <alper_ozturk@proton.me>
@alperozturk96 alperozturk96 added 3. to review Waiting for reviews and removed 2. developing Work in progress don't merge labels Oct 23, 2025
@alperozturk96 alperozturk96 marked this pull request as draft October 27, 2025 11:16
@alperozturk96
Copy link
Contributor Author

InputStreamBinder in Files app needs to be checked first.

@alperozturk96
Copy link
Contributor Author

alperozturk96 commented Oct 28, 2025

Android Files application is responsible for handling 304 response, thus this PR is not valid anymore.

nextcloud/notes-android#2883 (comment)

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