diff options
author | 2015-11-06 14:33:27 +0300 | |
---|---|---|
committer | 2015-11-06 14:33:27 +0300 | |
commit | c6e5f4092997365a36b2acd8d2c445714e36c6a1 (patch) | |
tree | a0e3e2db7857604c1df3f41092fc73bf975cf5ea /src/main/java/com/juick/http/www/NewMessage.java | |
parent | cd5d2934288b03c7af6da2480f4b392498e77724 (diff) |
try https downloads
Diffstat (limited to 'src/main/java/com/juick/http/www/NewMessage.java')
-rw-r--r-- | src/main/java/com/juick/http/www/NewMessage.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java index e2fe9629..d6ef22ee 100644 --- a/src/main/java/com/juick/http/www/NewMessage.java +++ b/src/main/java/com/juick/http/www/NewMessage.java @@ -33,6 +33,7 @@ import com.juick.xmpp.extensions.XOOB; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; +import java.net.URL; import java.net.URLEncoder; import java.sql.Connection; import java.util.ArrayList; @@ -169,9 +170,10 @@ public class NewMessage { } String paramImg = request.getParameter("img"); - if (attachmentFName == null && paramImg != null && paramImg.length() > 12 && paramImg.startsWith("http://") && !paramImg.equals("http://")) { + if (attachmentFName == null && paramImg != null) { try { - attachmentFName = Utils.downloadImage(paramImg); + URL imgUrl = new URL(paramImg); + attachmentFName = Utils.downloadImage(imgUrl); } catch (Exception e) { System.out.println("DOWNLOAD ERROR: " + e.toString()); response.sendError(500); @@ -326,9 +328,9 @@ public class NewMessage { } String paramImg = request.getParameter("img"); - if (attachmentFName == null && paramImg != null && paramImg.length() > 12 && paramImg.startsWith("http://") && !paramImg.equals("http://")) { + if (attachmentFName == null && paramImg != null) { try { - attachmentFName = Utils.downloadImage(paramImg); + attachmentFName = Utils.downloadImage(new URL(paramImg)); } catch (Exception e) { System.out.println("DOWNLOAD ERROR: " + e.toString()); response.sendError(500); |