This project is archived and is in readonly mode.
Route constraints regex with predefined characters classes in square brackets does not work
-
Andrew White
- State changed from new to open
- Milestone cleared.
- Assigned user set to Andrew White
- Importance changed from to Low
-
2kan
Looks like there is a bug in grammar for Regin regexp parser, because after we parse a regexp to expressions the "" symbol before "d" in regexp is lost. Gonna work on it tonight.
-
2kan
@Andrew White I think there is a bug in
expression = Regin.parse(regexp)in Rack::Mount::Utits.parse_regexp
And i see generated files in rack/mouint/vendor/regin/regin but there is no grammar files, also in the beginning of the files:
# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.6 # from Racc grammer file "". #So where can i get grammar files to find and fix a bug?
-
Szymon Kurcab
It seems to me that this is a HIGH priority issue.
The problem is with rack-mount using reign (as mentioned before) in Rails Router.Running in Rails 3.0.1 console (JRuby 1.5.3)
jruby-1.5.3 > expression = Regin.parse(/\D[%-.\w]*/)
=> #router.rb with the route definition
NCNAME = /\D[%-.\w]*/
match "/items/:item_id", :to => "items#index", :as => "item_base", :constraints => { :service_id => NCNAME }
Rails console tests:
jruby-1.5.3 > item_base_path('f')
=> "/items/f" jruby-1.5.3 > item_base_path('fee')
ActionController::RoutingError: No route matches {:controller=>"items", :item_id=>"fee"}jruby-1.5.3 > item_base_path('f.......')
=> "/items/f......." jruby-1.5.3 > item_base_path('fwwww')
=> "/items/fwwww" jruby-1.5.3 > item_base_path('fww-----....%ww')
=> "/items/fww-----....%ww" -
Szymon Kurcab
Running in Rails 3.0.1 console (JRuby 1.5.3)
jruby-1.5.3 > expression = Regin.parse(/\D[%-\.\w]*/) => #<Expression "\\D[%-.w]*"> -
Ravil Bayramgalin
@2kan, https://github.com/josh/rack-mount/blob/master/Rakefile#L16 - may be this will be of assistance
-
Andrew White
Okay, sent a pull request to Josh. Once that's been applied and then the vendored regin in rack-mount is updated we can then look at bumping the rack-mount version.
-
Andrew White
- State changed from open to resolved
This is now fixed in Rack::Mount 0.6.14 / Rails 3.0.6.