Skip to content

Conversation

@MuhamadSyabitHidayattulloh
Copy link
Contributor

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.

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.
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) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use contains ?

and not all webp is animated, it can be static too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add function to check webp images

@dragonx943 dragonx943 self-assigned this Nov 10, 2025
@dragonx943 dragonx943 merged commit 8e0b417 into DokiTeam:legacy Nov 12, 2025
1 check passed
dragonx943 pushed a commit that referenced this pull request Nov 12, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants