dev add tariff and temp flag for files
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-01-30 18:02:34 +07:00
parent 51ef63e8cd
commit 32f0a07e32
@@ -339,10 +339,10 @@ public class ApiController {
} }
Path filePath = Paths.get(entityResponse.getFilePath()); Path filePath = Paths.get(entityResponse.getProtectedFilePath());
Resource resource = new UrlResource(filePath.toUri());
// Resource resource = new UrlResource(filePath.toUri()); // Resource resource = new UrlResource(filePath.toUri());
FileSystemResource resource = new FileSystemResource(filePath);
long fileSize = Files.size(filePath);
if (!resource.exists()) { if (!resource.exists()) {
Map<String, Object> errorData = new HashMap<>(); Map<String, Object> errorData = new HashMap<>();
@@ -357,6 +357,7 @@ public class ApiController {
String contentType = determineContentType(filePath); String contentType = determineContentType(filePath);
return ResponseEntity.ok() return ResponseEntity.ok()
.contentLength(fileSize)
.contentType(MediaType.parseMediaType(contentType)) .contentType(MediaType.parseMediaType(contentType))
.header(HttpHeaders.CONTENT_DISPOSITION, .header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + entityResponse.getOriginalFileName() + "\"") "attachment; filename=\"" + entityResponse.getOriginalFileName() + "\"")