diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-03-28 20:27:16 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-04-02 18:20:01 +0300 |
commit | 2e3bc6a9415688d769134ee669fd457d63f497f8 (patch) | |
tree | 2f92ef930bbf16b90e01920cc22d78003e39f7cf /app/services | |
parent | 6b5ec93ad9e3a55ae0cba4fb677c2a6cff04cd70 (diff) |
Raise more descriptive errors when URLs are blocked
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/import_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index a34024f4f80..a3828acc50b 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -28,7 +28,11 @@ module Projects def add_repository_to_project if project.external_import? && !unknown_url? - raise Error, 'Blocked import URL.' if Gitlab::UrlBlocker.blocked_url?(project.import_url, valid_ports: Project::VALID_IMPORT_PORTS) + begin + Gitlab::UrlBlocker.validate!(project.import_url, valid_ports: Project::VALID_IMPORT_PORTS) + rescue Gitlab::UrlBlocker::BlockedUrlError => e + raise Error, "Blocked import URL: #{e.message}" + end end # We should skip the repository for a GitHub import or GitLab project import, |