aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/XMPPManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-10-23 08:09:05 +0300
committerGravatar Vitaly Takmazov2021-10-23 08:10:06 +0300
commit4b96a9b2e71b7a67effdd55b26ca532ff849d0ef (patch)
tree597a9b268622a10b440f3b119c529e624b8fdb62 /src/main/java/com/juick/XMPPManager.java
parent6b31c254b5a7ab6735c625459ba7936d9b2851e6 (diff)
ImagesService -> StorageService
img_path -> storage_path property
Diffstat (limited to 'src/main/java/com/juick/XMPPManager.java')
-rw-r--r--src/main/java/com/juick/XMPPManager.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java
index b42b4b9f..be1f8fd6 100644
--- a/src/main/java/com/juick/XMPPManager.java
+++ b/src/main/java/com/juick/XMPPManager.java
@@ -25,6 +25,7 @@ import com.juick.www.WebApp;
import com.juick.util.xmpp.iq.MessageQuery;
import com.juick.service.MessagesService;
import com.juick.service.PMQueriesService;
+import com.juick.service.StorageService;
import com.juick.service.UserService;
import com.juick.service.component.*;
import com.juick.util.MessageUtils;
@@ -102,8 +103,8 @@ public class XMPPManager implements NotificationListener {
private String componentHost;
@Value("${xmpp_password:secret}")
private String password;
- @Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
- private String tmpDir;
+ @Inject
+ private StorageService storageService;
@Value("classpath:juick.png")
private Resource vCardImage;
@@ -199,7 +200,7 @@ public class XMPPManager implements NotificationListener {
DigestUtils.md5Hex(String.format("%s-%s",
e.getInitiator().toString(), e.getSessionId()).getBytes()), attachmentExtension);
if (allowedTypes.contains(attachmentExtension)) {
- Path filePath = Paths.get(tmpDir, targetFilename);
+ Path filePath = Paths.get(storageService.getTemporaryDirectory(), targetFilename);
FileTransfer ft = e.accept(filePath).get();
ft.addFileTransferStatusListener(st -> {
logger.debug("{}: received {} of {}", e.getName(), st.getBytesTransferred(), e.getSize());