Browse Source

fix encodeUrlFileName method

陈精华 2 years ago
parent
commit
bfe4f73b49
4 changed files with 8 additions and 5 deletions
  1. 2 2
      Dockerfile
  2. 1 1
      pom.xml
  3. 2 2
      server/pom.xml
  4. 3 0
      server/src/main/java/cn/keking/utils/WebUtils.java

+ 2 - 2
Dockerfile

@@ -1,5 +1,5 @@
 FROM keking/kkfileview-jdk:latest
 MAINTAINER chenjh "842761733@qq.com"
 ADD server/target/kkFileView-*.tar.gz /opt/
-ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.3.0-SNAPSHOT/bin
-ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.3.0-SNAPSHOT/config/application.properties","-jar","/opt/kkFileView-4.3.0-SNAPSHOT/bin/kkFileView-4.3.0-SNAPSHOT.jar"]
+ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.3.0/bin
+ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.3.0/config/application.properties","-jar","/opt/kkFileView-4.3.0/bin/kkFileView-4.3.0.jar"]

+ 1 - 1
pom.xml

@@ -6,7 +6,7 @@
 
     <groupId>cn.keking</groupId>
     <artifactId>kkFileView-parent</artifactId>
-    <version>4.3.0-SNAPSHOT</version>
+    <version>4.3.0</version>
 
     <properties>
         <java.version>1.8</java.version>

+ 2 - 2
server/pom.xml

@@ -6,7 +6,7 @@
     <parent>
         <artifactId>kkFileView-parent</artifactId>
         <groupId>cn.keking</groupId>
-        <version>4.3.0-SNAPSHOT</version>
+        <version>4.3.0</version>
     </parent>
 
     <artifactId>kkFileView</artifactId>
@@ -336,7 +336,7 @@
                 <configuration>
                     <appendAssemblyId>false</appendAssemblyId>
                     <descriptors>
-                        <descriptor>src/main/assembly/dist-win32.xml</descriptor>
+<!--                        <descriptor>src/main/assembly/dist-win32.xml</descriptor>-->
                         <descriptor>src/main/assembly/dist-linux.xml</descriptor>
                     </descriptors>
                 </configuration>

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

@@ -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) {