dev add reset password
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-02-18 11:30:15 +07:00
parent ac11de2abb
commit 8811f3ce0e
2 changed files with 17 additions and 8 deletions
@@ -350,7 +350,7 @@ public class ApiController {
@PathVariable(required = false) Integer version,
@RequestHeader(value = "Authorization", required = false) String tokenHeader) {
try {
if (tokenHeader == null) {
if (tokenHeader == null || tokenHeader.isBlank()) {
Map<String, Object> errorData = new HashMap<>();
errorData.put("token", tokenHeader);
@@ -378,8 +378,8 @@ public class ApiController {
errorData.put("file_status", entityResponse.getStatus());
return ResponseEntity.ok().body(new BaseResponse(20004,
MessageCode.FILE_DOWNLOAD_ERROR.getCode(),
MessageCode.FILE_DOWNLOAD_ERROR.getDescription(),
MessageCode.FILE_DELETE.getCode(),
MessageCode.FILE_DELETE.getDescription(),
errorData));
}
@@ -388,14 +388,13 @@ public class ApiController {
errorData.put("onDisk", entityResponse.isExistsOnDisk());
return ResponseEntity.ok().body(new BaseResponse(20004,
MessageCode.FILE_DOWNLOAD_ERROR.getCode(),
MessageCode.FILE_DOWNLOAD_ERROR.getDescription(),
MessageCode.FILE_NOT_EXIST.getCode(),
MessageCode.FILE_NOT_EXIST.getDescription(),
errorData));
}
Path filePath = Paths.get(entityResponse.getProtectedFilePath());
// Resource resource = new UrlResource(filePath.toUri());
FileSystemResource resource = new FileSystemResource(filePath);
long fileSize = Files.size(filePath);
@@ -408,7 +407,7 @@ public class ApiController {
MessageCode.FILE_DOWNLOAD_ERROR.getDescription(),
errorData));
}
String contentType = determineContentType(filePath);
String contentType = determineContentType(filePath);
return ResponseEntity.ok()
.contentLength(fileSize)
@@ -424,7 +423,15 @@ public class ApiController {
MessageCode.FILE_NOT_FOUND.getCode(),
MessageCode.FILE_NOT_FOUND.getDescription(),
errorData));
} catch (NotFoundAuthToken | IOException e) {
} catch (NotFoundAuthToken e) {
Map<String, Object> errorData = new HashMap<>();
errorData.put("token", tokenHeader);
return ResponseEntity.ok().body(new BaseResponse(20004,
MessageCode.AUTH_TOKEN_NOT_FOUND.getCode(),
MessageCode.AUTH_TOKEN_NOT_FOUND.getDescription(),
errorData));
} catch (IOException e) {
Map<String, Object> errorData = new HashMap<>();
errorData.put("token", tokenHeader);
errorData.put("fileId", fileId);