RED-7500 Fix report storage id generation
This commit is contained in:
parent
0fb7ccf7a2
commit
515edb1c1c
@ -72,6 +72,8 @@ public class DownloadController implements DownloadResource {
|
||||
private final AccessControlService accessControlService;
|
||||
private final FileManagementStorageService fileManagementStorageService;
|
||||
|
||||
private final String REPORT_INFO = "/REPORT_INFO.json.gz";
|
||||
|
||||
@Value("${storage.backend:s3}")
|
||||
private String storageBackend;
|
||||
|
||||
@ -177,17 +179,10 @@ public class DownloadController implements DownloadResource {
|
||||
|
||||
removeDownloadRequest.getStorageIds().forEach(storageId -> {
|
||||
downloadService.deleteDownloadStatus(JSONPrimitive.of(storageId));
|
||||
|
||||
fileManagementStorageService.deleteObject(storageId);
|
||||
|
||||
String s3ReportJson = generateReportJsonStorageIdForS3(storageId);
|
||||
if (fileManagementStorageService.objectExists(s3ReportJson)) {
|
||||
fileManagementStorageService.deleteObject(s3ReportJson);
|
||||
}
|
||||
|
||||
String azureReportJson = generateReportJsonStorageIdForAzure(storageId);
|
||||
if (fileManagementStorageService.objectExists(azureReportJson)) {
|
||||
fileManagementStorageService.deleteObject(azureReportJson);
|
||||
}
|
||||
fileManagementStorageService.deleteObject(generateReportJsonStorageIdForS3(storageId));
|
||||
fileManagementStorageService.deleteObject(generateReportJsonStorageIdForAzure(storageId));
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
@ -304,12 +299,12 @@ public class DownloadController implements DownloadResource {
|
||||
|
||||
private String generateReportJsonStorageIdForS3(String storageId) {
|
||||
|
||||
return storageId.replace("zip", "/REPORT_INFO.json.gz");
|
||||
return storageId.substring(0, storageId.length() - 4) + REPORT_INFO;
|
||||
}
|
||||
|
||||
private String generateReportJsonStorageIdForAzure(String storageId) {
|
||||
|
||||
return storageId.replace(".zip", "/REPORT_INFO.json.gz");
|
||||
return storageId.substring(0, storageId.length() - 3) + REPORT_INFO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user