diff --git a/Library/Homebrew/cask/cask_loader.rb b/Library/Homebrew/cask/cask_loader.rb index 7bc9d18672..d1903483aa 100644 --- a/Library/Homebrew/cask/cask_loader.rb +++ b/Library/Homebrew/cask/cask_loader.rb @@ -181,7 +181,7 @@ module Cask # Cache compiled regex @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) end diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 41893a3f35..2f8f6df89a 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -366,7 +366,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy def parse_basename(url, search_query: true) 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) if (uri_query = uri.query.presence) @@ -382,7 +382,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy if (uri_path = uri.path.presence) components[:path] = uri_path.split("/").filter_map do |part| - URI::DEFAULT_PARSER.unescape(part).presence + URI::RFC2396_PARSER.unescape(part).presence end end else diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index a0dab860a1..db541b9050 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -661,7 +661,7 @@ module Formulary # Cache compiled regex @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) end