Commit 6d26e415 authored by 李秀明's avatar 李秀明
parent 7e23a914
package com.yeejoin.amos.fas.business.util;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -79,6 +80,10 @@ public class FileUtils {
* @return
*/
public static String fileToZip(List<String> list, String fileName, String ipUrl) {
if (StringUtils.isBlank(fileName)) {
throw new RuntimeException("文件名不能为空");
}
fileName = FilenameUtils.normalize(fileName);
InputStream fis = null;
BufferedInputStream bis = null;
FileOutputStream fos = null;
......@@ -91,7 +96,7 @@ public class FileUtils {
} else if (StringUtils.isBlank(tmpdir)){
tmpdir = "";
}
String path = tmpdir + fileName;
String path = FilenameUtils.normalize(tmpdir + fileName);
try {
File zipFile = new File(path);
zipFile.deleteOnExit();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment