From a473d512e6a224a0478063af1bd24743b5783c65 Mon Sep 17 00:00:00 2001 From: MuhamadSyabitHidayattulloh Date: Mon, 10 Nov 2025 16:17:26 +0700 Subject: [PATCH] fix: animated url logic The `isAnimatedUrl` function was previously using `endsWith` to check for animated image extensions. This failed for URLs that contained query parameters. The function has been updated to use `substringBefore("?")` to remove any query parameters before checking the extension, ensuring that animated images are correctly identified. --- app/src/main/kotlin/org/dokiteam/doki/core/util/ext/String.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/dokiteam/doki/core/util/ext/String.kt b/app/src/main/kotlin/org/dokiteam/doki/core/util/ext/String.kt index deb4737..90840af 100644 --- a/app/src/main/kotlin/org/dokiteam/doki/core/util/ext/String.kt +++ b/app/src/main/kotlin/org/dokiteam/doki/core/util/ext/String.kt @@ -72,7 +72,7 @@ fun Collection.joinToStringWithLimit(context: Context, limit: Int, transf fun String.isHttpUrl() = startsWith("https://", ignoreCase = true) || startsWith("http://", ignoreCase = true) -fun String.isAnimatedImage() = endsWith(".gif", ignoreCase = true) || endsWith(".webp", ignoreCase = true) +fun String.isAnimatedImage() = substringBefore("?").run { endsWith(".gif", ignoreCase = true) || endsWith(".webp", ignoreCase = true) } fun concatStrings(context: Context, a: String?, b: String?): String? = when { a.isNullOrEmpty() && b.isNullOrEmpty() -> null