RED-6864 - Fix storage update
This commit is contained in:
parent
1c62c5ddf4
commit
ede443a47a
@ -36,7 +36,7 @@ public class FileStorageService {
|
||||
@SneakyThrows
|
||||
public byte[] getOriginalFile(String dossierId, String fileId) {
|
||||
|
||||
InputStream inputStream = getInputStream(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.ORIGIN));
|
||||
InputStream inputStream = getInputStream(getStorageId(dossierId, fileId, FileType.ORIGIN));
|
||||
byte[] bytes = IOUtils.toByteArray(inputStream);
|
||||
inputStream.close();
|
||||
return bytes;
|
||||
@ -46,7 +46,7 @@ public class FileStorageService {
|
||||
@SneakyThrows
|
||||
public InputStream getOriginalFileAsStream(String dossierId, String fileId) {
|
||||
|
||||
return getInputStream(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.ORIGIN));
|
||||
return getInputStream(getStorageId(dossierId, fileId, FileType.ORIGIN));
|
||||
}
|
||||
|
||||
|
||||
@ -75,10 +75,10 @@ public class FileStorageService {
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private InputStream getInputStream(String dossierId, String fileId) {
|
||||
private InputStream getInputStream(String storageId) {
|
||||
|
||||
File tempFile = File.createTempFile("temp", ".data");
|
||||
storageService.downloadTo(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.ORIGIN), tempFile);
|
||||
storageService.downloadTo(TenantContext.getTenantId(), storageId, tempFile);
|
||||
return Files.newInputStream(Paths.get(tempFile.getPath()), StandardOpenOption.DELETE_ON_CLOSE);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user