Note body overwritten with the app's own error text when loading content fails

Open
#3,415 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, java
Domain
mobile

Research direction

Start with NotesServerSyncTask.pushLocalChanges around line 150, then follow the sync flow from NotesServerSyncTask.run. Check how failed content loads are represented before local changes are pushed. Done means an error or status message is shown without replacing the note body, and sync can retry later.

Written by the indexing model from the issue text.

Description

Environment

  • Nextcloud Notes for Android 35.0.0 (version code 350000090, play), signed in through the Nextcloud Files app (SSO)
  • Android 16 / API 37, Pixel 9 Pro (caiman)
  • Nextcloud server 34.0.5.1, server app notes 6.1.0

What happened

  1. A note existed on the server, 7041 bytes, real content.
  2. For a few seconds the server could not read the file (infrastructure problem on our side, file_get_contents(): Failed to open stream: Permission denied → OCP\Files\GenericFileException). While that was going on, the note was opened in the app and the editor showed Fehler: OCP\Files\GenericFileException instead of the content.
  3. Afterwards the note on the server was 40 bytes and contained:
Fehler: OCP\\Files\\GenericFileException

A version file created at the same second (…v1793375498) holds the same text with single backslashes, 38 bytes.

Why this looks client-side

The server log has no request and no error at the time of the write, so the write itself succeeded. The error string was uploaded as the note body by the client, and the backslashes were escaped on the second write.

Expected

The app should never write its own error or status text into the note body. Show the error, leave the note untouched, retry the sync later.

Impact

Silent data loss: the original 7041-byte note was replaced by an error message and would have been pushed to the server on the next sync.

Stack trace of the failing sync

java.lang.Exception: {"errorType":"Exception"}
[com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:440), ...]
	at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:150)
	at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:99)

Happy to provide server logs or a recording if that helps.

Dominant language
Java
Stars
1.1k
Forks
178
Avg merge
10h 48m
Merged PRs (30d)
41

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/notes-android

All issues in nextcloud/notes-android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.