Skip to content

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Oct 20, 2025

  • Tests written, or not not needed

Issue

Since MetadataWorker updates the eTag newly added files not determined by client any more, thus empty folder may appear.

Screen.Recording.2025-10-20.at.15.07.15.mov

Demo

Screenshot 2025-10-22 at 15 04 30

Changes

Only updates e-Tag after successful RefreshFolderOperation otherwise resets e-Tag.
Only stores new e-Tag after saving child files to storage.

How to test?

  1. Create sub folder in root directory
  2. Add one file from web
  3. Check metadata worker
  4. Create another sub folder from web
  5. Add big files to the first sub-folder
  6. Open app and navigate to the newly created subfolder
  7. Navigate back to the root (so that we can trigger worker to cancel previously unfinished job)
  8. Navigate to the newly created subfolder again
  9. Navigate back to the root
  10. Check new files existence from DB or navigate to the first subfolder

@alperozturk96 alperozturk96 force-pushed the fix/empty-folder-appereance branch from eaf5bdd to 8871c1e Compare October 22, 2025 12:09
Log_OC.d(TAG, "✅ Successfully fetched metadata for: ${folder.remotePath}")
} else {
Log_OC.e(TAG, "❌ Failed to fetch metadata for: ${folder.remotePath}, resetting e-Tag")
resetETag(folder, storageManager)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can safely reset the e-Tag if the RefreshFolderOperation fails. Since the operation is only executed when the e-Tag differs, setting it back to null in the event of a failure is acceptable and will not trigger any unnecessary additional operations.

mChildren = updatedFiles;

// update eTag
mLocalFolder.setEtag(remoteFolder.getEtag());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only update mLocalFolder e-Tag and file-length after saving all children files to the directory.

Later on in run fileDataStorageManager.saveFile(mLocalFolder); will be called after fetchAndSyncRemoteFolder

@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.34

@alperozturk96 alperozturk96 force-pushed the fix/empty-folder-appereance branch from ee24b75 to 6cc31de Compare October 24, 2025 06:46
@github-actions
Copy link

test-Unit test failed, but no output was generated. Maybe a preliminary stage failed.

@github-actions
Copy link

Codacy

Lint

TypemasterPR
Warnings4542
Errors1111

SpotBugs

SpotBugs increased!

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15819.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

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.

2 participants