public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Inline routing parameters are being mutated [#100 state:resolved]
dsutedja (author)
Mon Aug 18 11:30:31 -0700 2008
commit  78d98c80ac1e472efefd45f98757b53d0f5e4bde
tree    16f7f37243a7e2d10cfb5eee05e0edc06778244b
parent  da3fc84d7d1130f0c87bc51e7eee3143c86f7abc
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 * [#102] New association method in data_factory
0
 * [#101] Update to file upload testing (build_file -> file_for_upload, and multipart support in put)
0
+* [#100] Inline routing parameters are being mutated
0
 * [#96] Distributed Views module now uses file cache
0
 * [#92] Removed deprecated app_config.orm code.
0
 * [#91] Fixed Mack blowing up if there is no config/initializers/gems.rb file.
...
187
188
189
 
190
191
192
...
199
200
201
202
 
203
204
205
...
307
308
309
 
 
 
 
 
 
310
311
312
...
187
188
189
190
191
192
193
...
200
201
202
 
203
204
205
206
...
308
309
310
311
312
313
314
315
316
317
318
319
0
@@ -187,6 +187,7 @@ module Mack
0
       # also added to the 'params' object in the request.
0
       # If the route can not be found a Mack::Errors::UndefinedRoute exception is raised.
0
       def get_route_from_request(req)
0
+        orig_pattern = req.path_info.dup
0
         pattern = req.path_info.downcase
0
         unless pattern == "/"
0
           pattern.chop! if pattern.match(/\/$/)
0
@@ -199,7 +200,7 @@ module Mack
0
           rt.each do |route|
0
             if pattern.match(route.regex_pattern) && route.method == meth
0
               r = route
0
-              opts = r.options_with_embedded_parameters(pattern)
0
+              opts = r.options_with_embedded_parameters(orig_pattern)
0
               req.merge_params(opts)
0
               return opts
0
             end
0
@@ -307,6 +308,12 @@ module Mack
0
               opts[val] = split_uri[ind]
0
             end
0
           end
0
+          [:controller, :action].each do |key|
0
+            if opts[key]
0
+              opts[key] = opts[key].to_s.downcase.to_sym
0
+            end
0
+          end
0
+          
0
           opts
0
         end
0
         
...
24
25
26
 
 
 
 
 
 
 
27
28
29
...
36
37
38
39
 
40
41
42
...
24
25
26
27
28
29
30
31
32
33
34
35
36
...
43
44
45
 
46
47
48
49
0
@@ -24,6 +24,13 @@ describe Mack::Routes::RouteMap do
0
     lambda { get "/tst_users/asgaga/asgasg/asg" }.should raise_error(Mack::Errors::UndefinedRoute)
0
   end
0
   
0
+  it "should handle uri case properly" do
0
+    get "/TST_users/1-HelloWorld"
0
+    response.body.should match(/tst_users: show: id: 1-HelloWorld/)
0
+    get "/tst_users/1-helloworld"
0
+    response.body.should match(/tst_users: show: id: 1-helloworld/)
0
+  end
0
+  
0
   it "should have support for rails default style routes" do
0
     get "/tst_another/foo"
0
     response.body.should match(/tst_another_controller: foo: id: '' pickles: ''/)
0
@@ -36,7 +43,7 @@ describe Mack::Routes::RouteMap do
0
   
0
   it "should support unescaped params" do
0
     get "/tst_users/Who%27s+Your+Daddy%21%3F%21"
0
-    response.body.should match(/tst_users: show: id: who's your daddy!?!/)
0
+    response.body.should match(/tst_users: show: id: Who's Your Daddy!?!/)
0
   end
0
   
0
   it "should handle redirect" do

Comments