diff --git a/actionpack/lib/action_dispatch/journey/scanner.rb b/actionpack/lib/action_dispatch/journey/scanner.rb index 5ed587c1b1..2a075862e9 100644 --- a/actionpack/lib/action_dispatch/journey/scanner.rb +++ b/actionpack/lib/action_dispatch/journey/scanner.rb @@ -33,7 +33,7 @@ module ActionDispatch end private - + # takes advantage of String @- deduping capabilities in Ruby 2.5 upwards # see: https://bugs.ruby-lang.org/issues/13077 def dedup_scan(regex) @@ -58,9 +58,9 @@ module ActionDispatch [:SYMBOL, text] when text = dedup_scan(/\*\w+/) [:STAR, text] - when text = dedup_scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/) + when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/) text.tr! "\\", "" - [:LITERAL, text] + [:LITERAL, -text] # any char when text = dedup_scan(/./) [:LITERAL, text]