Merge pull request #10472 from nextcloud/thumbnailUpdateEnforced

When thumbnail update enforced, do not use any cached version
This commit is contained in:
Tobias Kaminsky 2022-07-04 14:36:43 +02:00 committed by GitHub
commit 5cdace49ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,11 +587,17 @@ public final class ThumbnailsCacheManager {
ServerFileInterface file = (ServerFileInterface) mFile;
String imageKey = PREFIX_THUMBNAIL + file.getRemoteId();
// Check disk cache in background thread
thumbnail = getBitmapFromDiskCache(imageKey);
boolean updateEnforced = (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded());
if (updateEnforced) {
thumbnail = null;
} else {
// Check disk cache in background thread
thumbnail = getBitmapFromDiskCache(imageKey);
}
// Not found in disk cache
if (thumbnail == null || (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded())) {
if (thumbnail == null) {
int pxW;
int pxH;
pxW = pxH = getThumbnailDimension();
@ -624,7 +630,13 @@ public final class ThumbnailsCacheManager {
if (thumbnail == null) {
// check if resized version is available
String resizedImageKey = PREFIX_RESIZED_IMAGE + file.getRemoteId();
Bitmap resizedImage = getBitmapFromDiskCache(resizedImageKey);
Bitmap resizedImage;
if (updateEnforced) {
resizedImage = null;
} else {
resizedImage = getBitmapFromDiskCache(resizedImageKey);
}
if (resizedImage != null) {
thumbnail = ThumbnailUtils.extractThumbnail(resizedImage, pxW, pxH);