Commit e9356356 authored by Timm Drevensek's avatar Timm Drevensek

fixed regex to match url pointing to a user repo

parent fe8c9021
...@@ -39,8 +39,8 @@ module SubmoduleHelper ...@@ -39,8 +39,8 @@ module SubmoduleHelper
end end
def relative_self_url?(url) def relative_self_url?(url)
# (./)? ( (../repo.git) | (../../project/repo.git) ) # (./)?(../repo.git) || (./)?(../../project/repo.git) )
url =~ /(^((\.\/)?(((\.\.)\/)|((\.\.)\/(\.\.)\/.*\/)))[^\.\/]*\.git)\Z/ url =~ /^((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\Z/ || url =~ /^((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\Z/
end end
def standard_links(host, project, commit) def standard_links(host, project, commit)
...@@ -49,7 +49,7 @@ module SubmoduleHelper ...@@ -49,7 +49,7 @@ module SubmoduleHelper
end end
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 = [ Gitlab.config.gitlab.url, '/', url[/.*\/(.*)\/.*\.git/, 1] ].join('')
else else
base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('') base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('')
......
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