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