This commit is contained in:
@@ -243,13 +243,11 @@ public class FileEntityService {
|
||||
if (Files.exists(protectedFilePath)) {
|
||||
Files.delete(protectedFilePath);
|
||||
}
|
||||
// SEND ON DISK
|
||||
|
||||
try (FileChannel channel = FileChannel.open(protectedFilePath, StandardOpenOption.WRITE)) {
|
||||
channel.force(true);
|
||||
}
|
||||
|
||||
// Files.write(protectedFilePath, data);
|
||||
|
||||
if (imageResizeService.isImage(extension)) {
|
||||
imageResizeService.generateSizes(fileEntity, data);
|
||||
}
|
||||
@@ -304,7 +302,7 @@ public class FileEntityService {
|
||||
return protectedPath;
|
||||
}
|
||||
|
||||
public void updateSignature(String signature, String fileId) throws IOException {
|
||||
public FileEntity updateSignature(String signature, String fileId) throws IOException {
|
||||
FileEntity fileEntity = fileEntityRepository.findByFileId(fileId);
|
||||
fileEntity.setSignature(signature);
|
||||
fileEntity.setProtectionStatus(ProtectionStatus.PROTECTED);
|
||||
@@ -312,7 +310,7 @@ public class FileEntityService {
|
||||
fileEntity.setProtectedAt(LocalDateTime.now());
|
||||
fileEntity.setProtectedFilePath(prepareProtectedPath(fileEntity, fileEntity.getFileExtension()).toString());
|
||||
|
||||
fileEntityRepository.save(fileEntity);
|
||||
return fileEntityRepository.save(fileEntity);
|
||||
}
|
||||
|
||||
public String formatFileSize(long size) {
|
||||
|
||||
Reference in New Issue
Block a user