Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Use eTag for Thumbnail Generation #14513

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Feb 7, 2025

  • Tests written, or not not needed

The OCFile remoteId is currently being used as the imageKey for thumbnail generation. This approach prevents the correct regeneration of thumbnails when a user uploads a different file with the same filename and extension.

Example:

  1. User uploads aa.jpg (479 KB) → Thumbnail is generated.
  2. User replaces it with aa.jpg (2124 KB) → Thumbnail is not regenerated because the remoteId remains unchanged, even though the eTag has been updated.

Proposed Solution:

To ensure proper thumbnail generation, the eTag should be used as the imageKey instead of the remoteId.

Known Issues:

The ConflictResolveDialog is currently unable to display thumbnails correctly in both the master branch and this PR. This issue will be addressed separately in a future PR.

Before

befd.mp4

After

after_generation.mp4

@alperozturk96 alperozturk96 changed the title BugFix - use eTag for Thumbnail Generation BugFix - Use eTag for Thumbnail Generation Feb 7, 2025
@alperozturk96 alperozturk96 added this to the Nextcloud App 3.31.0 milestone Feb 10, 2025
@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.31

@tobiasKaminsky
Copy link
Member

I think we need to discuss this approach.
First "problem" that comes to my mind:

  • create an image
  • let Android generate thumbnail with etag "123"
  • rename file
    --> new etag
    -> thus new thumbnail

@alperozturk96
Copy link
Collaborator Author

I think we need to discuss this approach. First "problem" that comes to my mind:

  • create an image
  • let Android generate thumbnail with etag "123"
  • rename file
    --> new etag
    -> thus new thumbnail

Exactly. In that case, it will regenerate the thumbnail. We can evaluate the pros and cons of this approach. If the advantages outweigh the disadvantages, we can proceed with this method. Alternatively, we can try to find a more distinct and reliable solution, maybe using a combination of remoteId, size, and hash, which may have fewer side effects.

@alperozturk96 alperozturk96 force-pushed the bugfix/use-e-tag-for-thumbnail-generation branch from 2756f39 to 6fb4f57 Compare February 12, 2025 12:35
Copy link

Codacy

Lint

TypemasterPR
Warnings5454
Errors33

SpotBugs

CategoryBaseNew
Bad practice6565
Correctness5859
Dodgy code294295
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness77
Performance5152
Security1818
Total502505

SpotBugs increased!

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/14513.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.

Copy link

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