From a864f8aefd985eaeca0daa60e7111b0bfd963993 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 22 May 2014 17:37:20 +1000 Subject: [PATCH] BUGFIX: sometimes we have stringio, it has no close --- lib/file_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/file_helper.rb b/lib/file_helper.rb index 1da9afca8eb..f390272d0b0 100644 --- a/lib/file_helper.rb +++ b/lib/file_helper.rb @@ -18,7 +18,8 @@ class FileHelper while f.size <= max_file_size && data = downloaded.read(max_file_size) f.write(data) end - downloaded.close! + # tiny files are StringIO, no close! on them + downloaded.close! if downloaded.respond_to? :close! end tmp