diff options
author | Nicolas Cavigneaux <nico@bounga.org> | 2014-10-09 15:06:26 +0200 |
---|---|---|
committer | Nicolas Cavigneaux <nico@bounga.org> | 2014-10-14 16:42:50 +0200 |
commit | 3041bb2a942711d7e4919795c9aff0d5d568568b (patch) | |
tree | aeee85e344150e9faeb9be2e6f33447c22f0b6ea /actionpack/lib/action_dispatch | |
parent | 5a5073301c66b7999ad25c18a22d44922002c689 (diff) | |
download | rails-3041bb2a942711d7e4919795c9aff0d5d568568b.tar.gz rails-3041bb2a942711d7e4919795c9aff0d5d568568b.tar.bz2 rails-3041bb2a942711d7e4919795c9aff0d5d568568b.zip |
Improve Journey compliance to RFC 3986
The scanner in Journey fails to recognize routes that use literals
from the sub-delims section of RFC 3986.
This commit enhance the compatibility of Journey with the RFC by
adding support of authorized delimiters to the scanner.
Fix #17212
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/scanner.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/journey/scanner.rb b/actionpack/lib/action_dispatch/journey/scanner.rb index 633be11a2d..ad1cd0f5e8 100644 --- a/actionpack/lib/action_dispatch/journey/scanner.rb +++ b/actionpack/lib/action_dispatch/journey/scanner.rb @@ -39,18 +39,18 @@ module ActionDispatch [:SLASH, text] when text = @ss.scan(/\*\w+/) [:STAR, text] - when text = @ss.scan(/\(/) + when text = @ss.scan(/(?<!\\)\(/) [:LPAREN, text] - when text = @ss.scan(/\)/) + when text = @ss.scan(/(?<!\\)\)/) [:RPAREN, text] when text = @ss.scan(/\|/) [:OR, text] when text = @ss.scan(/\./) [:DOT, text] - when text = @ss.scan(/:\w+/) + when text = @ss.scan(/(?<!\\):\w+/) [:SYMBOL, text] - when text = @ss.scan(/[\w%\-~]+/) - [:LITERAL, text] + when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\:|\\\(|\\\))+/) + [:LITERAL, text.gsub('\\', '')] # any char when text = @ss.scan(/./) [:LITERAL, text] |