Merge pull request #6742 from MikeMcQuaid/cask_loader_uri
cask_loader: fix URI detection.
This commit is contained in:
commit
13a249a426
@ -79,7 +79,13 @@ module Cask
|
|||||||
class FromURILoader < FromPathLoader
|
class FromURILoader < FromPathLoader
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
||||||
ref.to_s.match?(Regexp.new('\A' + uri_regex.source + '\Z', uri_regex.options))
|
return false unless ref.to_s.match?(Regexp.new('\A' + uri_regex.source + '\Z', uri_regex.options))
|
||||||
|
|
||||||
|
uri = URI(ref)
|
||||||
|
return false unless uri
|
||||||
|
return false unless uri.path
|
||||||
|
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :url
|
attr_reader :url
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user