deason 1 年之前
父節點
當前提交
e341f2b00a

+ 3 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/fss/impl/AliyunOssService.java

@@ -45,6 +45,9 @@ public class AliyunOssService implements FssService {
         if (!file.isFile()) {
             throw new StatusException("文件类型错误!");
         }
+        if (file.length() == 0) {
+            throw new StatusException("文件大小不能为0!");
+        }
 
         if (StringUtils.isNotEmpty(md5)) {
             String realMd5 = FssHelper.getFileMD5(file);

+ 3 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/fss/impl/TencentCosService.java

@@ -36,6 +36,9 @@ public class TencentCosService implements FssService {
         if (!file.isFile()) {
             throw new StatusException("文件类型错误!");
         }
+        if (file.length() == 0) {
+            throw new StatusException("文件大小不能为0!");
+        }
 
         if (StringUtils.isNotEmpty(md5)) {
             String realMd5 = FssHelper.getFileMD5(file);