Chris Roos
2007-Feb-12 13:13 UTC
Should I be able to escape and use reserved URI characters within Rails routing?
I have two failing tests (below) that illustrate my expected behaviour. I''m just not sure that my expectations are correct. In a nutshell. Should ''/foo/bar%2Fbaz'' try to match [''foo'', ''bar'', ''baz''] or [''foo'', ''bar%2Fbaz'']. Chris class UriReservedCharactersRoutingTest < Test::Unit::TestCase def setup ActionController::Routing.use_controllers! [''controller''] @set = ActionController::Routing::RouteSet.new @set.draw do |map| map.connect '':controller/:action/:var'' end end def test_should_escape_reserved_uri_characters_within_individual_path_components assert_equal ''/controller/action/p1%2Fp2'', @set.generate(:controller => ''controller'', :action => ''action'', :var => ''p1/p2'') end def test_should_recognize_escaped_path_component_and_unescape expected_options = {:var => "p1/p2", :controller => "controller", :action => "action"} assert_equal expected_options, @set.recognize_path (''/controller/action/p1%2Fp2'') end end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Roos
2007-Feb-12 22:14 UTC
Re: Should I be able to escape and use reserved URI characters within Rails routing?
Ok, so I''ve kinda convinced myself that my expectations were correct, and that the current routing implementation wasn''t quite right. I''ve extended the tests and provided a fix in the attached patch. Should I just go ahead and add as a ticket in trac? Chris On 2/12/07, Chris Roos <chrisjroos@gmail.com> wrote:> > I have two failing tests (below) that illustrate my expected behaviour. > I''m just not sure that my expectations are correct. > > In a nutshell. Should ''/foo/bar%2Fbaz'' try to match [''foo'', ''bar'', ''baz''] > or [''foo'', ''bar%2Fbaz'']. > > Chris > > class UriReservedCharactersRoutingTest < Test::Unit::TestCase > > def setup > ActionController::Routing.use_controllers! [''controller''] > @set = ActionController::Routing:: RouteSet.new > @set.draw do |map| > map.connect '':controller/:action/:var'' > end > end > > def > test_should_escape_reserved_uri_characters_within_individual_path_components > assert_equal ''/controller/action/p1%2Fp2'', @ set.generate(:controller > => ''controller'', :action => ''action'', :var => ''p1/p2'') > end > > def test_should_recognize_escaped_path_component_and_unescape > expected_options = {:var => "p1/p2", :controller => "controller", > :action => "action"} > assert_equal expected_options, @set.recognize_path > (''/controller/action/p1%2Fp2'') > end > > end--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2007-Feb-12 22:21 UTC
Re: Should I be able to escape and use reserved URI characters within Rails routing?
On 2/12/07, Chris Roos <chrisjroos@gmail.com> wrote:> > Ok, so I''ve kinda convinced myself that my expectations were correct, and > that the current routing implementation wasn''t quite right. > > I''ve extended the tests and provided a fix in the attached patch. Should > I just go ahead and add as a ticket in trac?Please do. I agree the behavior is wrong. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Roos
2007-Feb-12 23:22 UTC
Re: Should I be able to escape and use reserved URI characters within Rails routing?
Ok, all done. http://dev.rubyonrails.org/ticket/7544 Chris On 2/12/07, Jeremy Kemper <jeremy@bitsweat.net> wrote:> > On 2/12/07, Chris Roos <chrisjroos@gmail.com> wrote: > > > > Ok, so I''ve kinda convinced myself that my expectations were correct, > > and that the current routing implementation wasn''t quite right. > > > > I''ve extended the tests and provided a fix in the attached patch. > > Should I just go ahead and add as a ticket in trac? > > > Please do. I agree the behavior is wrong. > > jeremy > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Roos
2007-Feb-21 08:09 UTC
Re: Should I be able to escape and use reserved URI characters within Rails routing?
On 2/12/07, Chris Roos <chrisjroos@gmail.com> wrote:> > Ok, all done. > > http://dev.rubyonrails.org/ticket/7544 > > ChrisDoes anyone else have any input here, or should I just turn it into a plugin? Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2007-Feb-21 10:07 UTC
Re: Should I be able to escape and use reserved URI characters within Rails routing?
On 2/21/07, Chris Roos <chrisjroos@gmail.com> wrote:> > On 2/12/07, Chris Roos <chrisjroos@gmail.com> wrote: > > > > Ok, all done. > > > > http://dev.rubyonrails.org/ticket/7544 > > > > Chris > > > Does anyone else have any input here, or should I just turn it into a > plugin? >Applied. Thanks Chris. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---