delete files used for deposit in tmp storage

This commit is contained in:
Bernaldo Mihasi 2022-12-27 09:44:43 +02:00
parent 749dbefc38
commit 66b2596036
1 changed files with 8 additions and 1 deletions

View File

@ -2126,7 +2126,10 @@ public class DataManagementPlanManager {
} }
} }
} }
if(supportingFilesZip != null) {
Files.deleteIfExists(supportingFilesZip.toPath()); Files.deleteIfExists(supportingFilesZip.toPath());
}
Files.deleteIfExists(pdfFile.toPath());
Files.deleteIfExists(file.getFile().toPath()); Files.deleteIfExists(file.getFile().toPath());
return finalDoi; return finalDoi;
@ -2189,6 +2192,7 @@ public class DataManagementPlanManager {
if(supportingFilesZip != null) { if(supportingFilesZip != null) {
Files.deleteIfExists(supportingFilesZip.toPath()); Files.deleteIfExists(supportingFilesZip.toPath());
} }
Files.deleteIfExists(pdfFile.toPath());
Files.deleteIfExists(file.getFile().toPath()); Files.deleteIfExists(file.getFile().toPath());
return doiModel; return doiModel;
@ -2216,6 +2220,9 @@ public class DataManagementPlanManager {
} }
} }
zout.close(); zout.close();
if(!hasFileUploaded){
Files.deleteIfExists(new File(this.environment.getProperty("temp.temp") + "supportingFiles.zip").toPath());
}
return hasFileUploaded ? new File(this.environment.getProperty("temp.temp") + "supportingFiles.zip") : null; return hasFileUploaded ? new File(this.environment.getProperty("temp.temp") + "supportingFiles.zip") : null;
} }