update
This commit is contained in:
@@ -256,7 +256,7 @@ public class FileHandlerService {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
}else if (!url.startsWith("file://")) {
|
||||
url = Objects.requireNonNull(WebUtils.encodeUrlFileName(url))
|
||||
.replaceAll("\\+", "%20")
|
||||
.replaceAll("%3A", ":")
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.UUID;
|
||||
@@ -153,7 +155,8 @@ public class DownloadUtils {
|
||||
|
||||
// 处理file协议的文件下载
|
||||
private static void handleFileProtocol(URL url, String targetPath) throws IOException {
|
||||
File sourceFile = new File(url.getPath());
|
||||
String path = URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8);
|
||||
File sourceFile = new File(path);
|
||||
if (!sourceFile.exists()) {
|
||||
throw new FileNotFoundException("本地文件不存在: " + url.getPath());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user