aboutsummaryrefslogtreecommitdiff
path: root/juick-server-web/src/main/java/com/juick/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-27 15:19:06 +0300
committerGravatar Vitaly Takmazov2017-09-28 12:54:39 +0300
commit751b2a9b0fc523d17c9f7a410fadcc82eaaa1fb7 (patch)
tree1be25ccef6d38b4ec45084e389aed3045c1cdd70 /juick-server-web/src/main/java/com/juick/server
parente6e25791d6b9c8360247d92340b0dccda33c86ed (diff)
api: Telegram posting
Diffstat (limited to 'juick-server-web/src/main/java/com/juick/server')
-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;