diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-04-04 16:56:41 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-04-04 18:18:52 +0300 |
commit | 097636575c7d1e85b16e4c4eb7d87ce74137d64f (patch) | |
tree | 725bf14c2d89a7fe945921fcd0714bf59923ad75 /app/helpers/tree_helper.rb | |
parent | eaed588bf228c833cb666a61bc7d25cf21d5f94b (diff) |
Fix links to subdirectories of a directory with a plus character in its path
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r-- | app/helpers/tree_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index b64be89c181..5e7c20ef51e 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -123,7 +123,7 @@ module TreeHelper # returns the relative path of the first subdir that doesn't have only one directory descendant def flatten_tree(root_path, tree) - return tree.flat_path.sub(%r{\A#{root_path}/}, '') if tree.flat_path.present? + return tree.flat_path.sub(%r{\A#{Regexp.escape(root_path)}/}, '') if tree.flat_path.present? subtree = Gitlab::Git::Tree.where(@repository, @commit.id, tree.path) if subtree.count == 1 && subtree.first.dir? |