Commit d71cc2dd by djcp

Ensure the handle is closed after using OpenURI to get a remote file

parent 7e6b5b6f
...@@ -32,6 +32,7 @@ module Paperclip ...@@ -32,6 +32,7 @@ module Paperclip
while data = src.read(16*1024) while data = src.read(16*1024)
destination.write(data) destination.write(data)
end end
src.close
destination.rewind destination.rewind
destination destination
end end
......
...@@ -14,6 +14,10 @@ class UriProxyTest < Test::Unit::TestCase ...@@ -14,6 +14,10 @@ class UriProxyTest < Test::Unit::TestCase
assert_equal "thoughtbot-logo.png", @subject.original_filename assert_equal "thoughtbot-logo.png", @subject.original_filename
end end
should 'close open handle after reading' do
assert_equal true, @open_return.closed?
end
should "return a content type" do should "return a content type" do
assert_equal "image/png", @subject.content_type assert_equal "image/png", @subject.content_type
end end
......
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