Fix URI parser warning

This commit is contained in:
Mike McQuaid 2025-07-31 12:12:56 +01:00
parent 70bb266d91
commit 34bc30d639
No known key found for this signature in database
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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