Commit de8c7ed1 authored by Robert Speicher's avatar Robert Speicher Committed by Yorick Peterse

Merge branch 'fix/url-refactor-from-ee' into 'master'

Update CE code to include some refactor done in EE to do with import url

This is simply updating the code to match EE and avoid further conflicts related to `import_data` and `import_url` changes made on EE only.

See merge request !4223
parent d53b4d5b
...@@ -204,7 +204,7 @@ class Project < ActiveRecord::Base ...@@ -204,7 +204,7 @@ class Project < ActiveRecord::Base
state :finished state :finished
state :failed state :failed
after_transition any => :finished, do: :clear_import_data after_transition any => :finished, do: :reset_cache_and_import_attrs
end end
class << self class << self
...@@ -360,7 +360,7 @@ class Project < ActiveRecord::Base ...@@ -360,7 +360,7 @@ class Project < ActiveRecord::Base
end end
end end
def clear_import_data def reset_cache_and_import_attrs
update(import_error: nil) update(import_error: nil)
ProjectCacheWorker.perform_async(self.id) ProjectCacheWorker.perform_async(self.id)
...@@ -426,12 +426,7 @@ class Project < ActiveRecord::Base ...@@ -426,12 +426,7 @@ class Project < ActiveRecord::Base
end end
def safe_import_url def safe_import_url
result = URI.parse(self.import_url) Gitlab::UrlSanitizer.new(import_url).masked_url
result.password = '*****' unless result.password.nil?
result.user = '*****' unless result.user.nil? || result.user == "git" #tokens or other data may be saved as user
result.to_s
rescue
self.import_url
end end
def check_limit def check_limit
......
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