diff options
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); |