Commit ed5cd9f1 by Prem Sichanugrist

Remove the questionmark filename test for real file

parent bdfeebda
...@@ -99,42 +99,6 @@ unless ENV["S3_BUCKET"].blank? ...@@ -99,42 +99,6 @@ unless ENV["S3_BUCKET"].blank?
end end
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 context "An attachment that uses S3 for storage and uses AES256 encryption" do
setup do setup do
rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" }, rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
......
...@@ -231,6 +231,32 @@ class S3Test < Test::Unit::TestCase ...@@ -231,6 +231,32 @@ class S3Test < Test::Unit::TestCase
end end
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 context "" do
setup do setup do
rebuild_model :storage => :s3, rebuild_model :storage => :s3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment