]> source.dussan.org Git - gitblit.git/commitdiff
Escape folder names in JGitUtils to allow special characters. Fixes #999
authorMartin Spielmann <martin.spielmann@pingunaut.com>
Sat, 28 Jan 2017 14:24:57 +0000 (15:24 +0100)
committerFlorian Zschocke <florian.zschocke@devolo.de>
Mon, 10 Jun 2019 20:14:13 +0000 (22:14 +0200)
src/main/java/com/gitblit/utils/JGitUtils.java

index 0eea1d6156b4eb701bd3a56f6ffcd4fdcaf721cf..e70b4f996c5633088135e806f2e09b7753136d9a 100644 (file)
@@ -954,9 +954,9 @@ public class JGitUtils {
                        List<String> paths = new ArrayList<>();\r
 \r
                        while (tw.next()) {\r
-                                       String child = isPathEmpty ? tw.getPathString()\r
-                                                       : tw.getPathString().replaceFirst(String.format("%s/", path), "");\r
-                                       paths.add(child);\r
+                               String pathString = tw.getPathString();\r
+                               String child = isPathEmpty ? pathString : pathString.replaceFirst(Pattern.quote(String.format("%s/", path)), "");\r
+                               paths.add(child);\r
                        }\r
 \r
                        for(String p: PathUtils.compressPaths(paths)) {\r