新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录 Signed-off-by: 高雄 <admin@cxcp.com>pull/84/head
parent
cc7da00001
commit
a44e5ba518
|
@ -4,6 +4,7 @@ import cn.keking.config.ConfigConstants;
|
||||||
import cn.keking.model.ReturnResponse;
|
import cn.keking.model.ReturnResponse;
|
||||||
import cn.keking.utils.KkFileUtils;
|
import cn.keking.utils.KkFileUtils;
|
||||||
import cn.keking.utils.WebUtils;
|
import cn.keking.utils.WebUtils;
|
||||||
|
import cn.keking.service.CompressFileReader;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
@ -162,6 +163,24 @@ public class FileController {
|
||||||
return ReturnResponse.success(fileName);
|
return ReturnResponse.success(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/directory")
|
||||||
|
public Object directory(String urls) {
|
||||||
|
if (ObjectUtils.isEmpty(urls)) {
|
||||||
|
return ReturnResponse.failure("地址不合法!");
|
||||||
|
}
|
||||||
|
String fileUrl;
|
||||||
|
try {
|
||||||
|
fileUrl = WebUtils.decodeUrl(urls);
|
||||||
|
if (fileUrl.toLowerCase().startsWith("file:") || fileUrl.toLowerCase().startsWith("file%3")) {
|
||||||
|
return ReturnResponse.failure("地址不合法!");
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
return CompressFileReader.getTree(fileUrl);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean existsFile(String fileName) {
|
private boolean existsFile(String fileName) {
|
||||||
File file = new File(fileDir + demoPath + fileName);
|
File file = new File(fileDir + demoPath + fileName);
|
||||||
return file.exists();
|
return file.exists();
|
||||||
|
|
Loading…
Reference in New Issue