diff options
author | Timm Drevensek <abubadabu@gmail.com> | 2014-02-26 23:33:04 +0100 |
---|---|---|
committer | Timm Drevensek <abubadabu@gmail.com> | 2014-02-26 23:33:04 +0100 |
commit | e935635620cbc4a3f2f18303f12891cc997f1cb1 (patch) | |
tree | a0522918936383c9a70f0da94460b243059872c7 /app/helpers/submodule_helper.rb | |
parent | fe8c9021266c579127cf52f6456eb0090e400e63 (diff) | |
download | gitlab-ce-e935635620cbc4a3f2f18303f12891cc997f1cb1.tar.gz |
fixed regex to match url pointing to a user repo
Diffstat (limited to 'app/helpers/submodule_helper.rb')
-rwxr-xr-x | app/helpers/submodule_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index ca7b87b69ad..d7a253fac89 100755 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -39,8 +39,8 @@ module SubmoduleHelper end def relative_self_url?(url) - # (./)? ( (../repo.git) | (../../project/repo.git) ) - url =~ /(^((\.\/)?(((\.\.)\/)|((\.\.)\/(\.\.)\/.*\/)))[^\.\/]*\.git)\Z/ + # (./)?(../repo.git) || (./)?(../../project/repo.git) ) + url =~ /^((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\Z/ || url =~ /^((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\Z/ end def standard_links(host, project, commit) @@ -49,7 +49,7 @@ module SubmoduleHelper end 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('') else base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('') |