diff options
Diffstat (limited to 'juick-server-web/src/main/java/com/juick/server/util')
-rw-r--r-- | juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java | 6 |
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; |