Skip to content

Commit 3bff35c

Browse files
Martin Spielmannfzs
authored andcommitted
Escape folder names in JGitUtils to allow special characters. Fixes #999
1 parent a986898 commit 3bff35c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/gitblit/utils/JGitUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ public static List<PathModel> getFilesInPath2(Repository repository, String path
954954
List<String> paths = new ArrayList<>();
955955

956956
while (tw.next()) {
957-
String child = isPathEmpty ? tw.getPathString()
958-
: tw.getPathString().replaceFirst(String.format("%s/", path), "");
959-
paths.add(child);
957+
String pathString = tw.getPathString();
958+
String child = isPathEmpty ? pathString : pathString.replaceFirst(Pattern.quote(String.format("%s/", path)), "");
959+
paths.add(child);
960960
}
961961

962962
for(String p: PathUtils.compressPaths(paths)) {

0 commit comments

Comments
 (0)