Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Remove the questionmark filename test for real file
Browse files Browse the repository at this point in the history
  • Loading branch information
sikachu committed Jan 27, 2012
1 parent bdfeebd commit ed5cd9f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 36 deletions.
Binary file removed test/fixtures/question?mark.png
Binary file not shown.
36 changes: 0 additions & 36 deletions test/storage/s3_live_test.rb
Expand Up @@ -99,42 +99,6 @@ class S3LiveTest < Test::Unit::TestCase
end
end

context "An attachment that uses S3 for storage and has a question mark in file name" do
setup do
rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
:storage => :s3,
:bucket => ENV["S3_BUCKET"],
:s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))

Dummy.delete_all
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'question?mark.png'), 'rb')
@dummy.save
end

should "return an unescaped version for path" do
assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
end

should "return an escaped version for url" do
assert_match /.+\/question%3Fmark\.png/, @dummy.avatar.url
end

should "be accessible" do
assert_success_response @dummy.avatar.url
end

should "be accessible with an expiring url" do
assert_success_response @dummy.avatar.expiring_url
end

should "be destroyable" do
url = @dummy.avatar.url
@dummy.destroy
assert_not_found_response url
end
end

context "An attachment that uses S3 for storage and uses AES256 encryption" do
setup do
rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
Expand Down
26 changes: 26 additions & 0 deletions test/storage/s3_test.rb
Expand Up @@ -231,6 +231,32 @@ def teardown
end
end

context "An attachment that uses S3 for storage and has a question mark in file name" do
setup do
rebuild_model :styles => { :large => ['500x500#', :jpg] },
:storage => :s3,
:bucket => "bucket",
:s3_credentials => {
'access_key_id' => "12345",
'secret_access_key' => "54321"
}

file = StringIO.new(".")
file.original_filename = "question?mark.png"
@dummy = Dummy.new
@dummy.avatar = file
@dummy.save
end

should "return an unescaped version for path" do
assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
end

should "return an escaped version for url" do
assert_match /.+\/question%3Fmark\.png/, @dummy.avatar.url
end
end

context "" do
setup do
rebuild_model :storage => :s3,
Expand Down

0 comments on commit ed5cd9f

Please sign in to comment.