Sfoglia il codice sorgente

fix issue https://t.zsxq.com/0fpHww4Gy

陈精华 1 anno fa
parent
commit
2e9062d377

+ 6 - 0
server/src/main/java/cn/keking/service/FileHandlerService.java

@@ -355,6 +355,12 @@ public class FileHandlerService {
             fileName = fullFileName;
             type = FileType.typeFromFileName(fullFileName);
             suffix = KkFileUtils.suffixFromFileName(fullFileName);
+            // 移除fullfilename参数
+            if (url.indexOf("fullfilename=" + fullFileName + "&") > 0) {
+                url.replace("fullfilename=" + fullFileName + "&", "");
+            } else {
+                url.replace("fullfilename=" + fullFileName, "");
+            }
         } else {
             fileName = WebUtils.getFileNameFromURL(url);
             type = FileType.typeFromUrl(url);

+ 0 - 17
server/src/main/java/cn/keking/utils/WebUtils.java

@@ -154,23 +154,6 @@ public class WebUtils {
      */
     public static String encodeUrlFileName(String url) {
         String encodedFileName;
-        String fullFileName = WebUtils.getUrlParameterReg(url, "fullfilename");
-        if (fullFileName != null && fullFileName.length() > 0) {
-            try {
-                encodedFileName = URLEncoder.encode(fullFileName, "UTF-8");
-            } catch (UnsupportedEncodingException e) {
-                return null;
-            }
-            String  urlStrr = url.toLowerCase();  //转换为小写对比
-            boolean wjl =kuayu("&fullfilename=", urlStrr);  //判断是否启用文件流
-            if(wjl){
-                url =  url.substring(0,url.lastIndexOf("&"));  //删除添加的文件流内容
-            }
-            String noQueryUrl = url.substring(0, url.indexOf("?"));
-            String parameterStr = url.substring(url.indexOf("?"));
-            parameterStr = parameterStr.replaceFirst(fullFileName, encodedFileName);
-            return noQueryUrl + parameterStr;
-        }
         String noQueryUrl = url.substring(0, url.contains("?") ? url.indexOf("?") : url.length());
         int fileNameStartIndex = noQueryUrl.lastIndexOf('/') + 1;
         int fileNameEndIndex = noQueryUrl.lastIndexOf('.');