From 1bce739d036e709723ed083eac779a203ed4aa91 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 16 Mar 2022 09:44:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/help/glide/ImageLoader.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt index 3e6091993..11fab8a28 100644 --- a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt @@ -31,14 +31,21 @@ object ImageLoader { GlideApp.with(context).load(path) ) path.isAbsUrl() -> { - val url = kotlin.runCatching { - AnalyzeUrl(path).getGlideUrl() - }.getOrDefault(path) - GlideApp.with(context).load(url) + kotlin.runCatching { + val url = AnalyzeUrl(path).getGlideUrl() + GlideApp.with(context).load(url) + }.getOrDefault( + GlideApp.with(context).load(path) + ) } path.isContentScheme() -> GlideApp.with(context).load(Uri.parse(path)) else -> kotlin.runCatching { - GlideApp.with(context).load(File(path)) + val file = File(path) + if (file.exists()) { + GlideApp.with(context).load(file) + } else { + GlideApp.with(context).load(path) + } }.getOrElse { GlideApp.with(context).load(path) }