Commit 1b25a8f4374363d546d4a58f47c6fe00c3b3af07
1 parent
07a5cb2e
Exists in
master
and in
4 other branches
Improve Extract path
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
lib/extracts_path.rb
@@ -51,7 +51,7 @@ module ExtractsPath | @@ -51,7 +51,7 @@ module ExtractsPath | ||
51 | return pair unless @project | 51 | return pair unless @project |
52 | 52 | ||
53 | # Remove project, actions and all other staff from path | 53 | # Remove project, actions and all other staff from path |
54 | - input.gsub!("/#{@project.path_with_namespace}", "") | 54 | + input.gsub!(/^\/#{Regexp.escape(@project.path_with_namespace)}/, "") |
55 | input.gsub!(/^\/(tree|commits|blame|blob)\//, "") # remove actions | 55 | input.gsub!(/^\/(tree|commits|blame|blob)\//, "") # remove actions |
56 | input.gsub!(/\?.*$/, "") # remove stamps suffix | 56 | input.gsub!(/\?.*$/, "") # remove stamps suffix |
57 | input.gsub!(/.atom$/, "") # remove rss feed | 57 | input.gsub!(/.atom$/, "") # remove rss feed |
@@ -108,7 +108,9 @@ module ExtractsPath | @@ -108,7 +108,9 @@ module ExtractsPath | ||
108 | request.format = :atom | 108 | request.format = :atom |
109 | end | 109 | end |
110 | 110 | ||
111 | - @ref, @path = extract_ref(request.fullpath) | 111 | + path = request.fullpath.dup |
112 | + | ||
113 | + @ref, @path = extract_ref(path) | ||
112 | 114 | ||
113 | @id = File.join(@ref, @path) | 115 | @id = File.join(@ref, @path) |
114 | 116 |