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

use preview endpoint instead of thumbnail #13164

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.net.URLEncoder;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.res.ResourcesCompat;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import kotlin.text.Charsets;

/**
* Manager for concurrent access to thumbnails cache.
Expand Down Expand Up @@ -717,8 +715,9 @@ private Bitmap doThumbnailFromOCFileInBackground() {
// thumbnail
String uri;
if (file instanceof OCFile) {
uri = mClient.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" +
pxW + "/" + pxH + Uri.encode(file.getRemotePath(), "/");
uri = mClient.getBaseUri() + "/index.php/core/preview?fileId="
+ file.getLocalId()
+ "&x=" + pxW + "&y=" + pxH + "&a=1&mode=cover&forceIcon=0";
} else {
uri = mClient.getBaseUri() + "/index.php/apps/files_trashbin/preview?fileId=" +
file.getLocalId() + "&x=" + pxW + "&y=" + pxH;
Expand Down Expand Up @@ -1400,8 +1399,8 @@ private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMan
if (mClient != null) {
GetMethod getMethod = null;
try {
String uri = mClient.getBaseUri() + "/index.php/core/preview.png?file="
+ URLEncoder.encode(file.getRemotePath(), Charsets.UTF_8.name())
String uri = mClient.getBaseUri() + "/index.php/core/preview?fileId="
+ file.getRemoteId()
+ "&x=" + (pxW / 2) + "&y=" + (pxH / 2) + "&a=1&mode=cover&forceIcon=0";
Log_OC.d(TAG, "generate resized image: " + file.getFileName() + " URI: " + uri);
getMethod = new GetMethod(uri);
Expand Down
Loading