diff options
author | 2017-06-20 01:41:58 +0300 | |
---|---|---|
committer | 2017-06-20 01:41:58 +0300 | |
commit | f3312679fa538122cd81e0e9a0a251ebb296b80e (patch) | |
tree | 767fb6d52e07f6c9a43bec79e1c8ddfeaae1861c /juick-server/src/main/java/com/juick/server/util | |
parent | 894886e808cb8957e83c05921d2452421f1defd4 (diff) |
HttpUtils.downloadImage() takes additional argument,
one hardcoded path less
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/util')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/util/HttpUtils.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/util/HttpUtils.java b/juick-server/src/main/java/com/juick/server/util/HttpUtils.java index e54bef87..c305093c 100644 --- a/juick-server/src/main/java/com/juick/server/util/HttpUtils.java +++ b/juick-server/src/main/java/com/juick/server/util/HttpUtils.java @@ -61,7 +61,7 @@ public class HttpUtils { } return StringUtils.EMPTY; } - public static String downloadImage(URL url) throws Exception { + public static String downloadImage(URL url, String tmpDir) throws Exception { String attachmentFName = null; Exception ex = null; @@ -82,7 +82,7 @@ public class HttpUtils { } attachmentFName = UUID.randomUUID().toString() + "." + attachmentType; - fos = new FileOutputStream("/var/www/juick.com/i/tmp/" + attachmentFName); + fos = new FileOutputStream(Paths.get(tmpDir, attachmentFName).toString()); byte[] buffer = new byte[10240]; int len; while ((len = is.read(buffer)) > 0) { |