This commit is contained in:
@@ -124,12 +124,12 @@ public class FileController {
|
||||
|
||||
String filePath = type.equals("thumbnail") ? fileEntity.getThumbnailPath(): fileEntity.getFilePath();
|
||||
|
||||
File file = cloudStorageService.readFileFromStorageByPath(filePath);
|
||||
// InputStream file = cloudStorageService.readFileFromStorage(filePath);
|
||||
|
||||
if (file == null || !file.exists()) {
|
||||
log.error("File not found in storage: {}", fileEntity.getFilePath());
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
// if (file == null || !file.exists()) {
|
||||
// log.error("File not found in storage: {}", fileEntity.getFilePath());
|
||||
// return ResponseEntity.notFound().build();
|
||||
// }
|
||||
|
||||
if (fileEntity.getProtectionStatus() == ProtectionStatus.NOT_PROTECTED ||
|
||||
fileEntity.getProtectionStatus() == ProtectionStatus.PROCESSING) {
|
||||
@@ -142,7 +142,7 @@ public class FileController {
|
||||
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8)
|
||||
.replace("+", "%20");
|
||||
|
||||
InputStreamResource resource = new InputStreamResource(new FileInputStream(file));
|
||||
InputStreamResource resource = new InputStreamResource(cloudStorageService.readFileFromStorage(filePath));
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(new MediaType(fileEntity.getMimeType(), fileEntity.getFileExtension()))
|
||||
|
||||
Reference in New Issue
Block a user