From f3312679fa538122cd81e0e9a0a251ebb296b80e Mon Sep 17 00:00:00 2001 From: KillyMXI Date: Tue, 20 Jun 2017 01:41:58 +0300 Subject: HttpUtils.downloadImage() takes additional argument, one hardcoded path less --- juick-api/src/main/java/com/juick/api/controllers/Post.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'juick-api') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 322587fb..0173cf04 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -70,13 +70,12 @@ public class Post { } body = body.replace("\r", StringUtils.EMPTY); - String attachmentFName = HttpUtils.receiveMultiPartFile(attach, env.getProperty("upload_tmp_dir", - "/var/www/juick.com/i/tmp/")); + String attachmentFName = HttpUtils.receiveMultiPartFile(attach, apiServer.tmpDir); if (StringUtils.isBlank(attachmentFName) && img != null && img.length() > 10) { try { URL imgUrl = new URL(img); - attachmentFName = HttpUtils.downloadImage(imgUrl); + attachmentFName = HttpUtils.downloadImage(imgUrl, apiServer.tmpDir); } catch (Exception e) { logger.error("DOWNLOAD ERROR", e); throw new HttpBadRequestException(); @@ -139,12 +138,11 @@ public class Post { throw new HttpForbiddenException(); } - String attachmentFName = HttpUtils.receiveMultiPartFile(attach, env.getProperty("upload_tmp_dir", - "/var/www/juick.com/i/tmp/")); + String attachmentFName = HttpUtils.receiveMultiPartFile(attach, apiServer.tmpDir); if (StringUtils.isBlank(attachmentFName) && img != null && img.length() > 10) { try { - attachmentFName = HttpUtils.downloadImage(new URL(img)); + attachmentFName = HttpUtils.downloadImage(new URL(img), apiServer.tmpDir); } catch (Exception e) { logger.error("DOWNLOAD ERROR", e); throw new HttpBadRequestException(); -- cgit v1.2.3