xiatian 4 年 前
コミット
5188ec3fee

+ 6 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/filestorage/FileStorageUtil.java

@@ -302,6 +302,12 @@ public class FileStorageUtil {
      * @throws IOException
      */
     public static void saveUrlAs(String fileUrl, File localFile) {
+    	if (StringUtils.isBlank(fileUrl)) {
+    		throw new StatusException("500","文件链接为空");
+    	}
+    	if (!fileUrl.toLowerCase().startsWith("http") && !fileUrl.toLowerCase().startsWith("https")) {
+    		throw new StatusException("500","文件链接不是URL");
+    	}
         try {
             saveUrlAs(fileUrl, localFile.getAbsolutePath());
         } catch (IOException e) {