diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities/DownloadableFile.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/DownloadableFile.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java index 25f33907..7c8f95d1 100644 --- a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java +++ b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java @@ -56,12 +56,16 @@ public class DownloadableFile extends File { public String getMimeType() { String path = this.getAbsolutePath(); - String mime = URLConnection.guessContentTypeFromName(path); - if (mime != null) { - return mime; - } else if (mime == null && path.endsWith(".webp")) { - return "image/webp"; - } else { + try { + String mime = URLConnection.guessContentTypeFromName(path.replace("#","")); + if (mime != null) { + return mime; + } else if (mime == null && path.endsWith(".webp")) { + return "image/webp"; + } else { + return ""; + } + } catch (final StringIndexOutOfBoundsException e) { return ""; } } |