Commit 40470975 authored by Douwe Maan's avatar Douwe Maan

Add Project#safe_import_url helper.

parent 841a7c68
...@@ -253,14 +253,6 @@ module ProjectsHelper ...@@ -253,14 +253,6 @@ module ProjectsHelper
filename_path(project, :version) filename_path(project, :version)
end 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) def project_wiki_path_with_version(proj, page, version, is_newest)
url_params = is_newest ? {} : { version_id: version } url_params = is_newest ? {} : { version_id: version }
namespace_project_wiki_path(proj.namespace, proj, page, url_params) namespace_project_wiki_path(proj.namespace, proj, page, url_params)
......
...@@ -348,6 +348,14 @@ class Project < ActiveRecord::Base ...@@ -348,6 +348,14 @@ class Project < ActiveRecord::Base
import_status == 'finished' import_status == 'finished'
end 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 def check_limit
unless creator.can_create_project? or namespace.kind == 'group' 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") errors[:limit_reached] << ("Your project limit is #{creator.projects_limit} projects! Please contact your administrator to increase it")
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- else - else
Import in progress. Import in progress.
- unless @project.forked? - 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. %p Please wait while we import the repository for you. Refresh at will.
:javascript :javascript
new ProjectImport(); new ProjectImport();
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