Skip to content

Commit 43d2041

Browse files
Merge pull request #16503 from nextcloud/backport/16252/stable-3.36
[stable-3.36] Fix video thumbnail generation for media
2 parents 3d0d38e + 0481838 commit 43d2041

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/src/main/java/com/nextcloud/utils/extensions/OwnCloudClientExtensions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ fun OwnCloudClient.toNextcloudClient(context: Context): NextcloudClient = OwnClo
2121
isFollowRedirects
2222
)
2323

24-
fun OwnCloudClient.getPreviewEndpoint(localFileId: Long, x: Int, y: Int): String = baseUri
24+
fun OwnCloudClient.getPreviewEndpoint(remoteId: String, x: Int, y: Int): String = baseUri
2525
.toString() +
2626
"/index.php/core/preview?fileId=" +
27-
localFileId +
27+
remoteId +
2828
"&x=" + (x / 2) + "&y=" + (y / 2) +
2929
"&a=1&mode=cover&forceIcon=0"

app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ public static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMana
12701270
int pxW = p.x;
12711271
int pxH = p.y;
12721272

1273-
if (file.isDown()) {
1273+
if (file.isDown() && MimeTypeUtil.isImage(file)) {
12741274
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getStoragePath(), pxW, pxH);
12751275
if (bitmap != null) {
12761276
if (OCFileExtensionsKt.isPNG(file)) {
@@ -1283,7 +1283,7 @@ public static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMana
12831283
GetMethod getMethod = null;
12841284

12851285
try {
1286-
String uri = OwnCloudClientExtensionsKt.getPreviewEndpoint(mClient, file.getLocalId(), pxW, pxH);
1286+
String uri = OwnCloudClientExtensionsKt.getPreviewEndpoint(mClient, file.getRemoteId(), pxW, pxH);
12871287
Log_OC.d(TAG, "generating resized image: " + file.getFileName() + " URI: " + uri);
12881288

12891289
getMethod = new GetMethod(uri);

0 commit comments

Comments
 (0)