dev add pdf docs protect
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-10 20:50:06 +07:00
parent 19330d853d
commit 52e1a7dd02
2 changed files with 5 additions and 5 deletions
@@ -357,15 +357,13 @@ public class ApiController {
MessageCode.FILE_DOWNLOAD_ERROR.getDescription(), MessageCode.FILE_DOWNLOAD_ERROR.getDescription(),
errorData)); errorData));
} }
String contentType = determineContentType(filePath);
String contentType = determineContentType(filePath);
return ResponseEntity.ok() return ResponseEntity.ok()
.contentLength(fileSize) .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() + "\"")
"_nocopy_protected" + "\"")
.body(resource); .body(resource);
} catch (FileEntityNotFoundException e) { } catch (FileEntityNotFoundException e) {
Map<String, Object> errorData = new HashMap<>(); Map<String, Object> errorData = new HashMap<>();
@@ -389,7 +389,9 @@ public class FileEntityService {
.existsOnDisk(existsOnDisk) .existsOnDisk(existsOnDisk)
.supportId(fileEntity.getSupportId()) .supportId(fileEntity.getSupportId())
.protectStatus(fileEntity.getProtectionStatus().toString()) .protectStatus(fileEntity.getProtectionStatus().toString())
.fileName(fileEntity.getOriginalFileName()) .fileName(fileEntity.getOriginalFileName().replace("." +
fileEntity.getFileExtension(), "") + "_nocopy_protected" +
fileEntity.getFileExtension())
.ownerName(user.getFullName()) .ownerName(user.getFullName())
.ownerEmail(user.getEmail()) .ownerEmail(user.getEmail())
.ownerCompany(user.getCompanyName()) .ownerCompany(user.getCompanyName())