@quadrel-enterprise-ui/framework 19.7.0 → 19.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18832,12 +18832,16 @@ class QdFileCollectorValidationService {
|
|
|
18832
18832
|
this._config = config;
|
|
18833
18833
|
}
|
|
18834
18834
|
validateFile(file) {
|
|
18835
|
-
|
|
18835
|
+
const hasEmptyMimeType = !file.type;
|
|
18836
|
+
if (this.allowedMimeTypes && !hasEmptyMimeType && !this.allowedMimeTypes.includes(file.type)) {
|
|
18836
18837
|
return { type: QdUploadErrorType.INVALID_MIME_TYPE };
|
|
18837
18838
|
}
|
|
18838
18839
|
if (this.allowedFileNamePattern && !file.name.match(new RegExp(this.allowedFileNamePattern, 'i'))) {
|
|
18839
18840
|
return { type: QdUploadErrorType.INVALID_FILE_NAME };
|
|
18840
18841
|
}
|
|
18842
|
+
if (this.allowedMimeTypes && hasEmptyMimeType && !this.allowedFileNamePattern) {
|
|
18843
|
+
return { type: QdUploadErrorType.INVALID_MIME_TYPE };
|
|
18844
|
+
}
|
|
18841
18845
|
if (this.maxFileSizeInBytes && file.size > this.maxFileSizeInBytes) {
|
|
18842
18846
|
return { type: QdUploadErrorType.INVALID_FILE_SIZE };
|
|
18843
18847
|
}
|