Skip to content

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Oct 10, 2025

  • Tests written, or not not needed

Issue

The application collects modified files from ContentObserverWork as an array of strings, for example: content://media/external/images/media/2281. This array is then optionally passed to the AutoUploadWorker. The goal is to avoid scanning the entire local folder and instead only process the files that have changed.

However, errors can occur during this operation—for instance, the file path could be null, or the file may not exist. Such cases can result in upload information being lost, which may cause the auto-upload to fail.

Example crash log:

2025-10-09 15:49:24.520 17281-17324 FileSyncHelper          com.nextcloud.client                 D  getFileFromURI, URI: content://media/external/images/media/2275
2025-10-09 15:49:24.523 17281-17281 WM-SystemFgDispatcher   com.nextcloud.client                 D  Notifying with (id:266, workSpecId: 11ef7815-eaeb-4c0d-ad0e-363921909fdc, notificationType :1)
2025-10-09 15:49:24.527 17281-17324 FileSyncHelper          com.nextcloud.client                 E  cant get file from URI
2025-10-09 15:49:24.530 17281-17322 🔄📤AutoUpload          com.nextcloud.client                 D  Exception collectFileChangesFromContentObserverWork: java.lang.NullPointerException

Changes

Instead of failing the entire worker when encountering such issues, we should handle all potential edge cases. As a fallback, the worker should scan the entire local folder to ensure no files are missed for upload.

Documentation and links have been added to the functions, and function and variable names have been changed to prevent further confusions.

How to test?

  1. Set up a folder for auto-upload, e.g., the Pictures directory.
  2. Capture a photo using the Camera app that saves it to the configured folder.
  3. Verify that the new or changed file appears in the auto-upload folder and is processed correctly.

Signed-off-by: alperozturk <alper_ozturk@proton.me>
@alperozturk96 alperozturk96 force-pushed the fix/auto-upload-collect-change-files-file-from-uri branch from 7690679 to cc3d653 Compare October 10, 2025 10:41
Copy link

Copy link

Codacy

Lint

TypemasterPR
Warnings4545
Errors1111

SpotBugs

CategoryBaseNew
Bad practice4646
Correctness7474
Dodgy code267267
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3535
Performance4949
Security1818
Total499499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant