Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit d71cc2dd97d5b775f86336627fac3922e63903b7 1 parent 7e6b5b6
djcp authored
View
1  lib/paperclip/io_adapters/uri_adapter.rb
@@ -32,6 +32,7 @@ def copy_to_tempfile(src)
while data = src.read(16*1024)
destination.write(data)
end
+ src.close
destination.rewind
destination
end
View
4 test/io_adapters/uri_adapter_test.rb
@@ -14,6 +14,10 @@ class UriProxyTest < Test::Unit::TestCase
assert_equal "thoughtbot-logo.png", @subject.original_filename
end
+ should 'close open handle after reading' do
+ assert_equal true, @open_return.closed?
+ end
+
should "return a content type" do
assert_equal "image/png", @subject.content_type
end
Please sign in to comment.
Something went wrong with that request. Please try again.