Эх сурвалжийг харах

Fix to show thumbnails in FileBrowser

without this fix following Exception occurred:

I/RealImageLoader: 🚨 Failed - https://sermo.nextcloud.com/index.php/core/preview.png?file=%2F2022-09-12_163513.jpg&x=90&y=90&a=1&mode=cover&forceIcon=1 - coil.network.HttpException: HTTP 401:
E/RealImageLoader: coil.network.HttpException: HTTP 401:
        at coil.fetch.HttpUriFetcher.executeNetworkRequest(HttpUriFetcher.kt:227)
        at coil.fetch.HttpUriFetcher.access$executeNetworkRequest(HttpUriFetcher.kt:30)
        at coil.fetch.HttpUriFetcher$executeNetworkRequest$1.invokeSuspend(Unknown Source:15)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 жил өмнө
parent
commit
5d83ff8c98

+ 2 - 2
app/src/main/java/com/nextcloud/talk/extensions/ImageViewExtensions.kt

@@ -137,7 +137,7 @@ fun ImageView.loadThumbnail(url: String, user: User): io.reactivex.disposables.D
     }
 
     if (url.startsWith(user.baseUrl!!) &&
-        (url.contains("index.php/core/preview?fileId=") || url.contains("/avatar/"))
+        (url.contains("index.php/core/preview") || url.contains("/avatar/"))
     ) {
         requestBuilder.addHeader(
             "Authorization",
@@ -163,7 +163,7 @@ fun ImageView.loadImage(url: String, user: User, placeholder: Drawable? = null):
         .transformations(RoundedCornersTransformation(ROUNDING_PIXEL, ROUNDING_PIXEL, ROUNDING_PIXEL, ROUNDING_PIXEL))
 
     if (url.startsWith(user.baseUrl!!) &&
-        (url.contains("index.php/core/preview?fileId=") || url.contains("/avatar/"))
+        (url.contains("index.php/core/preview") || url.contains("/avatar/"))
     ) {
         requestBuilder.addHeader(
             "Authorization",