Commit c0744e5ba07a16475b014b976664c729c59516b7

Authored by Timm Drevensek
1 parent e9356356

simplify link url

Showing 1 changed file with 3 additions and 4 deletions   Show diff stats
app/helpers/submodule_helper.rb
@@ -50,11 +50,10 @@ module SubmoduleHelper @@ -50,11 +50,10 @@ module SubmoduleHelper
50 50
51 def relative_self_links(url, commit) 51 def relative_self_links(url, commit)
52 if url.scan(/(\.\.\/)/).size == 2 52 if url.scan(/(\.\.\/)/).size == 2
53 - base = [ Gitlab.config.gitlab.url, '/', url[/.*\/(.*)\/.*\.git/, 1] ].join('') 53 + base = url[/([^\/]*\/[^\/]*)\.git/, 1]
54 else 54 else
55 - base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('') 55 + base = [ @project.group.path, '/', url[/([^\/]*)\.git/, 1] ].join('')
56 end 56 end
57 - base = [ base, '/', url[/.*\/(.*)\.git/, 1] ].join('')  
58 - return base, [ base, '/tree/', commit ].join('') 57 + return project_path(base), project_tree_path(base, commit)
59 end 58 end
60 end 59 end