Skip to content

Commit

Permalink
Deal correctly with paths that contain spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Prinz authored and Blake Mizerany committed Apr 11, 2008
1 parent 307f93c commit 53c6609
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sinatra.rb
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions test/application_test.rb
@@ -1,5 +1,7 @@
require File.dirname(__FILE__) + '/helper'

require 'uri'

class TesterWithEach
def each
yield 'foo'
Expand Down Expand Up @@ -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


0 comments on commit 53c6609

Please sign in to comment.