RED-5945: 500 when importing faulty archive

* now throwing a BadRequestException when archive is faulty
This commit is contained in:
yhampe 2023-10-10 09:51:48 +02:00
parent 6ec370ad01
commit bc8ca76858

View File

@ -113,6 +113,9 @@ public class DossierTemplateImportService {
public String importDossierTemplate(ImportDossierTemplateRequest request) { public String importDossierTemplate(ImportDossierTemplateRequest request) {
ImportTemplateResult archiveResult = this.handleArchive(request); ImportTemplateResult archiveResult = this.handleArchive(request);
if(archiveResult == null) {
throw new BadRequestException("The provided archive is faulty");
}
return this.importDossierTemplate(archiveResult); return this.importDossierTemplate(archiveResult);
} }
@ -280,6 +283,9 @@ public class DossierTemplateImportService {
} }
} }
if(importTemplateResult.getDossierTemplate() == null) {
throw new BadRequestException("Provided archive is faulty");
}
return importTemplateResult; return importTemplateResult;
} finally { } finally {
if (tempFile != null) { if (tempFile != null) {