From 1bf81656417ce41e619155394f27ec930fade859 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 4 Jun 2024 16:38:31 -0400 Subject: [PATCH] Improving the detection of image types on the Media Feed. --- .../java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt | 2 +- .../main/java/com/vitorpamplona/amethyst/ui/note/types/Video.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt index 298ed1e1a..12374a735 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt @@ -50,7 +50,7 @@ fun FileHeaderDisplay( val hash = event.hash() val dimensions = event.dimensions() val description = event.content.ifEmpty { null } ?: event.alt() - val isImage = RichTextParser.isImageUrl(fullUrl) + val isImage = event.mimeType()?.startsWith("image/") == true || RichTextParser.isImageUrl(fullUrl) val uri = note.toNostrUri() mutableStateOf( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Video.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Video.kt index c779b561f..563bb12c8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Video.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Video.kt @@ -85,7 +85,7 @@ fun VideoDisplay( val hash = event.hash() val dimensions = event.dimensions() val description = event.content.ifBlank { null } ?: event.alt() - val isImage = RichTextParser.isImageUrl(fullUrl) + val isImage = event.mimeType()?.startsWith("image/") == true || RichTextParser.isImageUrl(fullUrl) val uri = note.toNostrUri() mutableStateOf(