diff --git a/Library/Homebrew/rubocops/cask/homepage_url_trailing_slash.rb b/Library/Homebrew/rubocops/cask/homepage_url_trailing_slash.rb index 313f9ef04f..c26c1848e7 100644 --- a/Library/Homebrew/rubocops/cask/homepage_url_trailing_slash.rb +++ b/Library/Homebrew/rubocops/cask/homepage_url_trailing_slash.rb @@ -11,6 +11,7 @@ module RuboCop # if it does not have a path component. class HomepageUrlTrailingSlash < Base include OnHomepageStanza + include HelperFunctions extend AutoCorrector MSG_NO_SLASH = "'%s' must have a slash after the domain." @@ -27,7 +28,8 @@ module RuboCop return unless url&.match?(%r{^.+://[^/]+$}) - domain = URI(url_node.str_content).host + domain = URI(string_content(url_node, strip_dynamic: true)).host + return if domain.blank? # This also takes URLs like 'https://example.org?path' # and 'https://example.org#path' into account.