From 235bb5b9fc7072531f19cc25c3b07258198d86ec Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 17 May 2018 22:39:28 +0300 Subject: ImagesService refactoring --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'juick-server-jdbc/src/main/java') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index 6c12583c..612431bf 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -56,8 +56,6 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ private SearchService searchService; @Inject private ImagesService imagesService; - @Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}") - private String imgDir; @Value("${img_url:https://i.juick.com/}") private String baseImagesUrl; @@ -94,10 +92,12 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ quoteUser.setName(rs.getString(20)); msg.setTo(quoteUser); } - try { - imagesService.setAttachmentMetadata(imgDir, baseImagesUrl, msg); - } catch (Exception e) { - logger.warn("exception reading images for mid {} rid {}", msg.getMid(), msg.getRid(), e); + if (StringUtils.isNotEmpty(msg.getAttachmentType())) { + try { + imagesService.setAttachmentMetadata(baseImagesUrl, msg); + } catch (Exception e) { + logger.warn("exception reading images for mid {} rid {}", msg.getMid(), msg.getRid(), e); + } } return msg; } -- cgit v1.2.3