@@ -43,8 +43,8 @@ public class FileController {
|
||||
FileEntity fileEntity = fileRepository.findById(fileId)
|
||||
.orElseThrow(() -> new RuntimeException("File not found"));
|
||||
|
||||
if (fileEntity.getProtectionStatus() != ProtectionStatus.NOT_PROTECTED) {
|
||||
throw new RuntimeException("File is protected");
|
||||
if (fileEntity.getProtectionStatus() == ProtectionStatus.NOT_PROTECTED) {
|
||||
throw new RuntimeException("File is not protected");
|
||||
}
|
||||
|
||||
Resource resource = fileStorageService.loadFileAsResource(fileEntity.getProtectedFilePath());
|
||||
|
||||
Reference in New Issue
Block a user