diff options
author | Toon Claes <toon@gitlab.com> | 2017-03-09 18:39:09 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-03-10 12:03:03 +0300 |
commit | c92808ed323d70c6af00cd19fb5e4ed35ce9957d (patch) | |
tree | 4992cd77091121d4e4a1546d880634abc408a0d0 /lib/gitlab/url_sanitizer.rb | |
parent | 7a7f487775d4ed3de5698064b90af6da6488a59b (diff) |
Fix for creating a project through API when import_url is nil
The API was returning 500 when `nil` is passed for the `import_url`.
In fact, it was `Gitlab::UrlSanitizer.valid?` which was throwing a
`NoMethodError` when `nil` value was passed.
Diffstat (limited to 'lib/gitlab/url_sanitizer.rb')
-rw-r--r-- | lib/gitlab/url_sanitizer.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/url_sanitizer.rb b/lib/gitlab/url_sanitizer.rb index 1f0d96088cf..c81dc7e30d0 100644 --- a/lib/gitlab/url_sanitizer.rb +++ b/lib/gitlab/url_sanitizer.rb @@ -9,6 +9,8 @@ module Gitlab end def self.valid?(url) + return false unless url + Addressable::URI.parse(url.strip) true |