public
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatrarb.com
Clone URL: git://github.com/JackDanger/sinatra.git
Deal correctly with paths that contain spaces
cypher (author)
Fri Apr 11 13:36:26 -0700 2008
Blake Mizerany (committer)
Fri Apr 11 13:56:59 -0700 2008
commit  53c6609f39a6b1901b46660c01e9ba1cb4ebe07d
tree    0ab90227cd74f80cda367e32da51446f090de565
parent  307f93c6f100d7144814d06863e821e65753c1b8
...
145
146
147
148
 
149
150
151
...
145
146
147
 
148
149
150
151
0
@@ -145,7 +145,7 @@ module Sinatra
0
     attr_reader :path, :block, :param_keys, :pattern, :options
0
     
0
     def initialize(path, options = {}, &b)
0
- @path = path
0
+ @path = URI.encode(path)
0
       @block = b
0
       @param_keys = []
0
       @options = options
...
1
2
 
 
3
4
5
...
155
156
157
 
 
 
 
 
 
 
 
 
 
 
 
 
158
159
160
...
1
2
3
4
5
6
7
...
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
0
@@ -1,5 +1,7 @@
0
 require File.dirname(__FILE__) + '/helper'
0
 
0
+require 'uri'
0
+
0
 class TesterWithEach
0
   def each
0
     yield 'foo'
0
@@ -155,6 +157,19 @@ context "Events in an app" do
0
 
0
   end
0
   
0
+ specify "can deal with spaces in paths" do
0
+
0
+ path = '/path with spaces'
0
+
0
+ get path do
0
+ "Look ma, a path with spaces!"
0
+ end
0
+
0
+ get_it URI.encode(path)
0
+
0
+ body.should.equal "Look ma, a path with spaces!"
0
+ end
0
+
0
 end
0
 
0
 

Comments

    No one has commented yet.