Fix URI parser warning
This commit is contained in:
parent
70bb266d91
commit
34bc30d639
@ -181,7 +181,7 @@ module Cask
|
|||||||
|
|
||||||
# Cache compiled regex
|
# Cache compiled regex
|
||||||
@uri_regex ||= begin
|
@uri_regex ||= begin
|
||||||
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
uri_regex = ::URI::RFC2396_PARSER.make_regexp
|
||||||
Regexp.new("\\A#{uri_regex.source}\\Z", uri_regex.options)
|
Regexp.new("\\A#{uri_regex.source}\\Z", uri_regex.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -366,7 +366,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
def parse_basename(url, search_query: true)
|
def parse_basename(url, search_query: true)
|
||||||
components = { path: T.let([], T::Array[String]), query: T.let([], T::Array[String]) }
|
components = { path: T.let([], T::Array[String]), query: T.let([], T::Array[String]) }
|
||||||
|
|
||||||
if url.match?(URI::DEFAULT_PARSER.make_regexp)
|
if url.match?(URI::RFC2396_PARSER.make_regexp)
|
||||||
uri = URI(url)
|
uri = URI(url)
|
||||||
|
|
||||||
if (uri_query = uri.query.presence)
|
if (uri_query = uri.query.presence)
|
||||||
@ -382,7 +382,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
if (uri_path = uri.path.presence)
|
if (uri_path = uri.path.presence)
|
||||||
components[:path] = uri_path.split("/").filter_map do |part|
|
components[:path] = uri_path.split("/").filter_map do |part|
|
||||||
URI::DEFAULT_PARSER.unescape(part).presence
|
URI::RFC2396_PARSER.unescape(part).presence
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@ -661,7 +661,7 @@ module Formulary
|
|||||||
|
|
||||||
# Cache compiled regex
|
# Cache compiled regex
|
||||||
@uri_regex ||= begin
|
@uri_regex ||= begin
|
||||||
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
uri_regex = ::URI::RFC2396_PARSER.make_regexp
|
||||||
Regexp.new("\\A#{uri_regex.source}\\Z", uri_regex.options)
|
Regexp.new("\\A#{uri_regex.source}\\Z", uri_regex.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user