This commit is contained in:
@@ -63,11 +63,11 @@ public class FileController {
|
||||
FileEntity fileEntity = fileRepository.findById(fileId)
|
||||
.orElseThrow(() -> new FileNotFoundException("Not found: " + fileId));
|
||||
|
||||
Path filePath = Paths.get(fileEntity.getFilePath());
|
||||
if (!Files.exists(filePath)) {
|
||||
log.error("Not on disk: {}", fileEntity.getFilePath());
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
// Path filePath = Paths.get(fileEntity.getFilePath());
|
||||
// if (!Files.exists(filePath)) {
|
||||
// log.error("Not on disk: {}", fileEntity.getFilePath());
|
||||
// return ResponseEntity.notFound().build();
|
||||
// }
|
||||
|
||||
File file = cloudStorageService.readFileFromStorageByPath(fileEntity.getFilePath());
|
||||
|
||||
@@ -86,7 +86,7 @@ public class FileController {
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(mediaType)
|
||||
.contentLength(Files.size(filePath))
|
||||
.contentLength(file.length())
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString())
|
||||
.header(HttpHeaders.CACHE_CONTROL, "public, max-age=3600")
|
||||
.body(resource);
|
||||
|
||||
Reference in New Issue
Block a user