文件下载时FileNotFoundException %20 路
2020-09-08 本文已影响0人
3anLouYouGu1
问题
文件下载时 路径带空格自动转化成%20导致FileNotFoundException系统找不到指定的路径。
image.png
image.png
解决方法
//防止空格路径报错
try {
srcPath = URLDecoder.decode(srcPath,"utf-8");
}catch (UnsupportedEncodingException e){
e.printStackTrace();
}