From 751b2a9b0fc523d17c9f7a410fadcc82eaaa1fb7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 27 Sep 2017 15:19:06 +0300 Subject: api: Telegram posting --- juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'juick-server-web/src/main/java/com/juick/server/util') 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; -- cgit v1.2.3