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 New Thumbnail Key for Thumbnail Generation #14513

Closed
wants to merge 10 commits into 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.

Proposed Solution:

To ensure proper thumbnail generation, the getThumbnailKey() 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
@ZetaTom
Copy link
Collaborator

ZetaTom commented Feb 14, 2025

Using only remoteId as a key for our thumbnail cache also causes other problems. The Shared tab is notoriously difficult to work with, as it solely relies on the data returned by the sharing API. In this case, remoteId is no set, which is why the default placeholder thumbnail is displayed instead. (See #14437) Because of this, I think we should re-evaluate what key to use.

@alperozturk96 alperozturk96 force-pushed the bugfix/use-e-tag-for-thumbnail-generation branch from 6fb4f57 to 471cf8e Compare February 17, 2025 08:14
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
@nextcloud nextcloud deleted a comment from github-actions bot Feb 17, 2025
Signed-off-by: alperozturk <[email protected]>
@alperozturk96 alperozturk96 changed the title BugFix - Use eTag for Thumbnail Generation BugFix - Use New Thumbnail Key for Thumbnail Generation Feb 17, 2025
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

Codacy

Lint

TypemasterPR
Warnings5454
Errors33

SpotBugs

CategoryBaseNew
Bad practice6565
Correctness5858
Dodgy code294295
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness77
Performance5155
Security1818
Total502507

SpotBugs increased!

Copy link

@alperozturk96
Copy link
Collaborator Author

I discussed with @tobiasKaminsky . isUpdateThumbnailNeeded() will be used for solving this problem.

@alperozturk96
Copy link
Collaborator Author

#14556

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.

3 participants