Allow files without extensions in QCHAT_ATTACHMENT validation.

This commit is contained in:
CalDescent 2023-01-22 15:59:16 +00:00
parent 9f30571b12
commit 6196841609

View File

@ -42,7 +42,8 @@ public enum Service {
return ValidationResult.DIRECTORIES_NOT_ALLOWED;
}
final String extension = FilenameUtils.getExtension(file.getName()).toLowerCase();
final List<String> allowedExtensions = Arrays.asList("zip", "pdf", "txt", "odt", "ods", "doc", "docx", "xls", "xlsx", "ppt", "pptx");
// We must allow blank file extensions because these are used by data published from a plaintext or base64-encoded string
final List<String> allowedExtensions = Arrays.asList("zip", "pdf", "txt", "odt", "ods", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "");
if (extension == null || !allowedExtensions.contains(extension)) {
return ValidationResult.INVALID_FILE_EXTENSION;
}