livecheck: handle URI#parse URI::InvalidURIError

This commit is contained in:
Sam Ford 2020-11-26 10:31:38 -05:00
parent 1f40d84ab1
commit d07590442c
No known key found for this signature in database
GPG Key ID: 95209E46C7FFDEFE

View File

@ -314,7 +314,12 @@ module Homebrew
# Preprocesses and returns the URL used by livecheck.
# @return [String]
def preprocess_url(url)
begin
uri = URI.parse url
rescue URI::InvalidURIError
return url
end
host = uri.host == "github.s3.amazonaws.com" ? "github.com" : uri.host
path = uri.path.delete_prefix("/").delete_suffix(".git")
scheme = uri.scheme