fix tempfile_for_uri for rails 3
the Tempfile doesn't default to binary in rails 3 Change-Id: I3478f97b8c330c770e517fb6618695fc20cab990 Reviewed-on: https://gerrit.instructure.com/30699 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
34f9e2c425
commit
f460a6c453
|
@ -89,10 +89,13 @@ module Canvas::HTTP
|
|||
def self.tempfile_for_uri(uri)
|
||||
basename = File.basename(uri.path)
|
||||
basename, ext = basename.split(".", 2)
|
||||
if ext
|
||||
tmpfile = if ext
|
||||
Tempfile.new([basename, ext])
|
||||
else
|
||||
Tempfile.new(basename)
|
||||
end
|
||||
tmpfile.set_encoding(Encoding::BINARY) if tmpfile.respond_to?(:set_encoding)
|
||||
tmpfile.binmode
|
||||
tmpfile
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue