diff options
author | James Lopez <james@jameslopez.es> | 2016-07-12 16:21:28 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-07-12 16:21:28 +0200 |
commit | ad6ff2238045d6b7873144eb302aa953c9f1fc66 (patch) | |
tree | debebcedf6f9c3950daf4e16b51d200203df1e01 /app | |
parent | b7ba5fa06bfb434c9227a2175f936fc31fd3444f (diff) | |
download | gitlab-ce-ad6ff2238045d6b7873144eb302aa953c9f1fc66.tar.gz |
fixes a few issues to do with import_url not being saved correctly for imports. This should prevent the import_data to be created when it should not and output an error properly validating before creating it.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | app/services/projects/import_service.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index a66b750cd48..57ea948390b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -162,7 +162,7 @@ class Project < ActiveRecord::Base validates :namespace, presence: true validates_uniqueness_of :name, scope: :namespace_id validates_uniqueness_of :path, scope: :namespace_id - validates :import_url, addressable_url: true, if: :external_import? + validates :import_url, addressable_url: true, if: :import_url validates :star_count, numericality: { greater_than_or_equal_to: 0 } validate :check_limit, on: :create validate :avatar_type, @@ -464,8 +464,8 @@ class Project < ActiveRecord::Base return super(value) unless Gitlab::UrlSanitizer.valid?(value) import_url = Gitlab::UrlSanitizer.new(value) - create_or_update_import_data(credentials: import_url.credentials) super(import_url.sanitized_url) + create_or_update_import_data(credentials: import_url.credentials) if valid? end def import_url diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 163ebf26c84..cdad0426b02 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -43,7 +43,7 @@ module Projects def import_repository begin gitlab_shell.import_repository(project.repository_storage_path, project.path_with_namespace, project.import_url) - rescue Gitlab::Shell::Error => e + rescue => e raise Error, "Error importing repository #{project.import_url} into #{project.path_with_namespace} - #{e.message}" end end |