simplify link url

This commit is contained in:
Timm Drevensek 2014-02-28 17:22:07 +01:00
parent e935635620
commit c0744e5ba0

View file

@ -50,11 +50,10 @@ module SubmoduleHelper
def relative_self_links(url, commit) def relative_self_links(url, commit)
if url.scan(/(\.\.\/)/).size == 2 if url.scan(/(\.\.\/)/).size == 2
base = [ Gitlab.config.gitlab.url, '/', url[/.*\/(.*)\/.*\.git/, 1] ].join('') base = url[/([^\/]*\/[^\/]*)\.git/, 1]
else else
base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('') base = [ @project.group.path, '/', url[/([^\/]*)\.git/, 1] ].join('')
end end
base = [ base, '/', url[/.*\/(.*)\.git/, 1] ].join('') return project_path(base), project_tree_path(base, commit)
return base, [ base, '/tree/', commit ].join('')
end end
end end