diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-21 10:39:57 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-21 10:39:57 +0000 |
commit | 4146be04482f27bc10246dd471c3f08ec258e0ed (patch) | |
tree | 46888bb77e8a34608a9cb1a9fe015671e9efbe8f /app | |
parent | 2f0a2e99f18838e53f9a7946aaaf656e11c2ef4f (diff) | |
parent | be25bbc4d2c7e3d5cf3da6f51cb7f7355295ef52 (diff) | |
download | gitlab-ce-4146be04482f27bc10246dd471c3f08ec258e0ed.tar.gz |
Merge branch '29685-wrong-number-of-arguments-calling-http_url_to_repo-on-cloning-project-wikis' into 'master'
Fix ProjectWiki#http_url_to_repo signature
Closes #29685
See merge request !10079
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | app/models/project_wiki.rb | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 4a3faff7d5b..da4704554b3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -881,13 +881,9 @@ class Project < ActiveRecord::Base end def http_url_to_repo(user = nil) - url = web_url + credentials = Gitlab::UrlSanitizer.http_credentials_for_user(user) - if user - url.sub!(%r{\Ahttps?://}) { |protocol| "#{protocol}#{user.username}@" } - end - - "#{url}.git" + Gitlab::UrlSanitizer.new("#{web_url}.git", credentials: credentials).full_url end # Check if current branch name is marked as protected in the system diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 539b31780b3..70eef359cdd 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -42,8 +42,11 @@ class ProjectWiki url_to_repo end - def http_url_to_repo - [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') + def http_url_to_repo(user = nil) + url = "#{Gitlab.config.gitlab.url}/#{path_with_namespace}.git" + credentials = Gitlab::UrlSanitizer.http_credentials_for_user(user) + + Gitlab::UrlSanitizer.new(url, credentials: credentials).full_url end def wiki_base_path |