Fix encoding in directory listings

This commit is contained in:
Garret Alfert 2013-07-11 13:44:40 +02:00
parent fa7c7ad020
commit c6059153f8
2 changed files with 18 additions and 3 deletions

View File

@ -250,7 +250,7 @@ module RemoteStorage
DateTime.rfc2822(entry["last_modified"]).to_i
end
listing.merge!({ CGI.escape(entry_name) => timestamp })
listing.merge!({ entry_name => timestamp })
end
listing

View File

@ -26,7 +26,7 @@ describe "Directories" do
last_response.content_type.must_equal "application/json"
content = JSON.parse(last_response.body)
content.must_include "http%3A%2F%2F5apps.com"
content.must_include "http://5apps.com"
content.must_include "foo"
content["foo"].must_be_kind_of Integer
content["foo"].to_s.length.must_equal 13
@ -65,7 +65,7 @@ describe "Directories" do
content = JSON.parse(last_response.body)
content.must_include "foo"
content.must_include "http%3A%2F%2F5apps.com"
content.must_include "http://5apps.com"
content.must_include "home/"
content["home/"].must_be_kind_of Integer
content["home/"].to_s.length.must_equal 13
@ -224,6 +224,21 @@ describe "Directories" do
end
end
context "special characters in object name" do
before do
put "/jimmy/tasks/bla~blub", "some task"
end
it "lists the containing object" do
get "/jimmy/tasks/"
last_response.status.must_equal 200
content = JSON.parse(last_response.body)
content.must_include "bla~blub"
end
end
context "for the root directory" do
before do
auth = auth_bucket.new("jimmy:123")