Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Deal correctly with paths that contain spaces

  • Loading branch information...
commit 53c6609f39a6b1901b46660c01e9ba1cb4ebe07d 1 parent 307f93c
Markus Prinz authored Blake Mizerany committed
Showing with 16 additions and 1 deletion.
  1. +1 −1  lib/sinatra.rb
  2. +15 −0 test/application_test.rb
View
2  lib/sinatra.rb
@@ -145,7 +145,7 @@ class Event
attr_reader :path, :block, :param_keys, :pattern, :options
def initialize(path, options = {}, &b)
- @path = path
+ @path = URI.encode(path)
@block = b
@param_keys = []
@options = options
View
15 test/application_test.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/helper'
+require 'uri'
+
class TesterWithEach
def each
yield 'foo'
@@ -155,6 +157,19 @@ def foo
end
+ specify "can deal with spaces in paths" do
+
+ path = '/path with spaces'
+
+ get path do
+ "Look ma, a path with spaces!"
+ end
+
+ get_it URI.encode(path)
+
+ body.should.equal "Look ma, a path with spaces!"
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.