aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-01-03 16:06:59 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-01-03 16:06:59 +0100
commitbe7de054be6b31b82947b9c641c8b1d5bbefb284 (patch)
tree31c7f444f0a2c8a655a436cda804d53485263e22 /src/main/java/eu/siacs/conversations/entities/DownloadableFile.java
parent960b7343d3bf2511be4a6da838b9cf4a0f0a3c43 (diff)
record voice and attachment refactor
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities/DownloadableFile.java')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/DownloadableFile.java16
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 "";
}
}