aboutsummaryrefslogtreecommitdiff
path: root/juick-server-web/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-web/src')
-rw-r--r--juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
index 971587a8..db920e88 100644
--- a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
+++ b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
@@ -77,8 +77,12 @@ public class HttpUtils {
attachmentType = "jpg";
} else if (mime != null && mime.equals("image/png")) {
attachmentType = "png";
+ } else if (url.getFile().toLowerCase().endsWith("jpg")) {
+ attachmentType = "jpg";
+ } else if (url.getFile().toLowerCase().endsWith("png")) {
+ attachmentType = "png";
} else {
- throw new Exception("Wrong file type");
+ throw new Exception("Wrong file type: " + mime);
}
attachmentFName = DigestUtils.md5Hex(UUID.randomUUID().toString()) + "." + attachmentType;