don't deposit empty supportingFiles.zip when no files are uploaded in datasets
This commit is contained in:
parent
e1a3e9b7bc
commit
572be373e5
|
@ -150,8 +150,10 @@ public class DataverseDeposit implements RepositoryDeposit {
|
|||
this.uploadFile(jsonFileName, rdaJson, doi);
|
||||
Files.deleteIfExists(rdaJson.toPath());
|
||||
|
||||
if(dmpDepositModel.getSupportingFilesZip() != null) {
|
||||
this.uploadFile(dmpDepositModel.getSupportingFilesZip().getName(), dmpDepositModel.getSupportingFilesZip(), doi);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getDatasetIdentifier(String previousDOI) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
|
|
@ -2196,7 +2196,7 @@ public class DataManagementPlanManager {
|
|||
FileOutputStream fout = new FileOutputStream(this.environment.getProperty("temp.temp") + "supportingFiles.zip");
|
||||
ZipOutputStream zout = new ZipOutputStream(fout);
|
||||
|
||||
//List<File> supportingFiles = new ArrayList<>();
|
||||
boolean hasFileUploaded = false;
|
||||
Set<Dataset> datasets = dmp.getDataset();
|
||||
for (Dataset dataset : datasets) {
|
||||
List<FileUpload> files = this.apiContext.getOperationsContext().getDatabaseRepository().getFileUploadDao().getFileUploads(dataset.getId());
|
||||
|
@ -2209,12 +2209,12 @@ public class DataManagementPlanManager {
|
|||
zout.putNextEntry(ze);
|
||||
zout.write(content, 0, content.length);
|
||||
zout.closeEntry();
|
||||
|
||||
hasFileUploaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
zout.close();
|
||||
return new File(this.environment.getProperty("temp.temp") + "supportingFiles.zip");
|
||||
return hasFileUploaded ? new File(this.environment.getProperty("temp.temp") + "supportingFiles.zip") : null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue