Browse Source

Merge branch 'dev' of http://94.191.59.107:3000/wukai/lzga-doc into dev

yxc 2 years ago
parent
commit
8e0659efc7

+ 18 - 17
lzga-modules/lzga-file/src/main/java/com/jjt/file/utils/FileUploadUtils.java

@@ -117,23 +117,24 @@ public class FileUploadUtils {
 
         String fileName = file.getOriginalFilename();
         String extension = FileTypeUtils.getExtension(file);
-        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
-            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
-                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
-                        fileName);
-            } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
-                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
-                        fileName);
-            } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
-                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
-                        fileName);
-            } else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
-                throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
-                        fileName);
-            } else {
-                throw new InvalidExtensionException(allowedExtension, extension, fileName);
-            }
-        }
+        //取消文件扩展名校验
+//        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
+//            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
+//                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
+//                        fileName);
+//            } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
+//                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
+//                        fileName);
+//            } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
+//                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
+//                        fileName);
+//            } else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
+//                throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
+//                        fileName);
+//            } else {
+//                throw new InvalidExtensionException(allowedExtension, extension, fileName);
+//            }
+//        }
     }
 
     /**