This commit is contained in:
@@ -339,10 +339,10 @@ public class ApiController {
|
||||
}
|
||||
|
||||
|
||||
Path filePath = Paths.get(entityResponse.getFilePath());
|
||||
Resource resource = new UrlResource(filePath.toUri());
|
||||
|
||||
Path filePath = Paths.get(entityResponse.getProtectedFilePath());
|
||||
// Resource resource = new UrlResource(filePath.toUri());
|
||||
FileSystemResource resource = new FileSystemResource(filePath);
|
||||
long fileSize = Files.size(filePath);
|
||||
|
||||
if (!resource.exists()) {
|
||||
Map<String, Object> errorData = new HashMap<>();
|
||||
@@ -357,6 +357,7 @@ public class ApiController {
|
||||
String contentType = determineContentType(filePath);
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentLength(fileSize)
|
||||
.contentType(MediaType.parseMediaType(contentType))
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename=\"" + entityResponse.getOriginalFileName() + "\"")
|
||||
|
||||
Reference in New Issue
Block a user