fix encodeUrlFileName method

This commit is contained in:
陈精华
2023-03-24 14:03:13 +08:00
parent 7f9f402a82
commit bfe4f73b49
4 changed files with 8 additions and 5 deletions

View File

@ -157,6 +157,9 @@ public class WebUtils {
String noQueryUrl = url.substring(0, url.contains("?") ? url.indexOf("?") : url.length());
int fileNameStartIndex = noQueryUrl.lastIndexOf('/') + 1;
int fileNameEndIndex = noQueryUrl.lastIndexOf('.');
if (fileNameEndIndex < fileNameStartIndex) {
return url;
}
try {
encodedFileName = URLEncoder.encode(noQueryUrl.substring(fileNameStartIndex, fileNameEndIndex), "UTF-8");
} catch (UnsupportedEncodingException e) {