Escape slash in database name

This commit is contained in:
Brian Candler 2009-03-26 09:40:45 +00:00 committed by Matt Aimonetti
parent 4337e676ee
commit 190bd13723
2 changed files with 10 additions and 2 deletions

View file

@ -17,7 +17,7 @@ module CouchRest
@name = name
@server = server
@host = server.uri
@uri = @root = "#{host}/#{name}"
@uri = @root = "#{host}/#{name.gsub('/','%2F')}"
@streamer = Streamer.new(self)
@bulk_save_cache = []
@bulk_save_cache_limit = 500 # must be smaller than the uuid count

View file

@ -7,7 +7,15 @@ describe CouchRest::Database do
@db.delete! rescue nil
@db = @cr.create_db(TESTDB) rescue nil
end
describe "database name including slash" do
it "should escape the name in the URI" do
db = @cr.database("foo/bar")
db.name.should == "foo/bar"
db.uri.should == "#{COUCHHOST}/foo%2Fbar"
end
end
describe "map query with _temp_view in Javascript" do
before(:each) do
@db.bulk_save([