summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-02 22:39:02 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-02 22:39:02 +0200
commit1b25a8f4374363d546d4a58f47c6fe00c3b3af07 (patch)
tree11da7c96e5ad2a08cc6e690909b8f9ec382f7450 /lib/extracts_path.rb
parent07a5cb2ef80ab4087a2edfb3571adf4cb8780ca2 (diff)
downloadgitlab-ce-1b25a8f4374363d546d4a58f47c6fe00c3b3af07.tar.gz
Improve Extract path
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 220e3d2271f..0b7a0d47caf 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -51,7 +51,7 @@ module ExtractsPath
return pair unless @project
# Remove project, actions and all other staff from path
- input.gsub!("/#{@project.path_with_namespace}", "")
+ input.gsub!(/^\/#{Regexp.escape(@project.path_with_namespace)}/, "")
input.gsub!(/^\/(tree|commits|blame|blob)\//, "") # remove actions
input.gsub!(/\?.*$/, "") # remove stamps suffix
input.gsub!(/.atom$/, "") # remove rss feed
@@ -108,7 +108,9 @@ module ExtractsPath
request.format = :atom
end
- @ref, @path = extract_ref(request.fullpath)
+ path = request.fullpath.dup
+
+ @ref, @path = extract_ref(path)
@id = File.join(@ref, @path)