Commit 1b25a8f4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve Extract path

parent 07a5cb2e
...@@ -51,7 +51,7 @@ module ExtractsPath ...@@ -51,7 +51,7 @@ module ExtractsPath
return pair unless @project return pair unless @project
# Remove project, actions and all other staff from path # 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!(/^\/(tree|commits|blame|blob)\//, "") # remove actions
input.gsub!(/\?.*$/, "") # remove stamps suffix input.gsub!(/\?.*$/, "") # remove stamps suffix
input.gsub!(/.atom$/, "") # remove rss feed input.gsub!(/.atom$/, "") # remove rss feed
...@@ -108,7 +108,9 @@ module ExtractsPath ...@@ -108,7 +108,9 @@ module ExtractsPath
request.format = :atom request.format = :atom
end end
@ref, @path = extract_ref(request.fullpath) path = request.fullpath.dup
@ref, @path = extract_ref(path)
@id = File.join(@ref, @path) @id = File.join(@ref, @path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment