diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-11-11 16:23:51 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-11-18 12:00:56 +0100 |
commit | 40470975e863b271f09fe147eb2eb545211e1b08 (patch) | |
tree | 31132260a89b6a5a8752496b51ff87a9a9a7e1bb | |
parent | 841a7c6897b23957286056498cc3f05ec4330d15 (diff) | |
download | gitlab-ce-40470975e863b271f09fe147eb2eb545211e1b08.tar.gz |
Add Project#safe_import_url helper.
-rw-r--r-- | app/helpers/projects_helper.rb | 8 | ||||
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | app/views/projects/imports/show.html.haml | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 690ae2090db..c9cd4a0d54c 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -253,14 +253,6 @@ module ProjectsHelper filename_path(project, :version) end - def hidden_pass_url(original_url) - result = URI(original_url) - result.password = '*****' unless result.password.nil? - result - rescue - original_url - end - def project_wiki_path_with_version(proj, page, version, is_newest) url_params = is_newest ? {} : { version_id: version } namespace_project_wiki_path(proj.namespace, proj, page, url_params) diff --git a/app/models/project.rb b/app/models/project.rb index c2ff103759a..70a648e68a3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -348,6 +348,14 @@ class Project < ActiveRecord::Base import_status == 'finished' end + def safe_import_url + result = URI.parse(self.import_url) + result.password = '*****' unless result.password.nil? + result.to_s + rescue + original_url + end + def check_limit unless creator.can_create_project? or namespace.kind == 'group' errors[:limit_reached] << ("Your project limit is #{creator.projects_limit} projects! Please contact your administrator to increase it") diff --git a/app/views/projects/imports/show.html.haml b/app/views/projects/imports/show.html.haml index 06886d215a3..c0d1ce0d120 100644 --- a/app/views/projects/imports/show.html.haml +++ b/app/views/projects/imports/show.html.haml @@ -8,7 +8,7 @@ - else Import in progress. - unless @project.forked? - %p.monospace git clone --bare #{hidden_pass_url(@project.import_url)} + %p.monospace git clone --bare #{@project.safe_import_url} %p Please wait while we import the repository for you. Refresh at will. :javascript new ProjectImport(); |