Fix Rubocop trailing / bug
This commit is contained in:
parent
e6cb1f18e7
commit
7d145f5798
@ -11,6 +11,7 @@ module RuboCop
|
|||||||
# if it does not have a path component.
|
# if it does not have a path component.
|
||||||
class HomepageUrlTrailingSlash < Base
|
class HomepageUrlTrailingSlash < Base
|
||||||
include OnHomepageStanza
|
include OnHomepageStanza
|
||||||
|
include HelperFunctions
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
|
|
||||||
MSG_NO_SLASH = "'%<url>s' must have a slash after the domain."
|
MSG_NO_SLASH = "'%<url>s' must have a slash after the domain."
|
||||||
@ -27,7 +28,8 @@ module RuboCop
|
|||||||
|
|
||||||
return unless url&.match?(%r{^.+://[^/]+$})
|
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'
|
# This also takes URLs like 'https://example.org?path'
|
||||||
# and 'https://example.org#path' into account.
|
# and 'https://example.org#path' into account.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user