From 3bff35cdbc7136e5d945c9f2830aa4fdcde19f75 Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Sat, 28 Jan 2017 15:24:57 +0100 Subject: [PATCH] Escape folder names in JGitUtils to allow special characters. Fixes #999 --- src/main/java/com/gitblit/utils/JGitUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java index 0eea1d61..e70b4f99 100644 --- a/src/main/java/com/gitblit/utils/JGitUtils.java +++ b/src/main/java/com/gitblit/utils/JGitUtils.java @@ -954,9 +954,9 @@ public class JGitUtils { List paths = new ArrayList<>(); while (tw.next()) { - String child = isPathEmpty ? tw.getPathString() - : tw.getPathString().replaceFirst(String.format("%s/", path), ""); - paths.add(child); + String pathString = tw.getPathString(); + String child = isPathEmpty ? pathString : pathString.replaceFirst(Pattern.quote(String.format("%s/", path)), ""); + paths.add(child); } for(String p: PathUtils.compressPaths(paths)) { -- 2.39.5