media file: fix exception on empty files.

This may happen if a user uploads from a source that returns an error
HTTP response with no data.
This commit is contained in:
evazion
2020-06-22 16:59:28 -05:00
parent 8c6759bbd7
commit a6994cd4d7
4 changed files with 6 additions and 2 deletions

View File

View File

@@ -98,6 +98,10 @@ class MediaFileTest < ActiveSupport::TestCase
should "determine the correct extension for a flash file" do
assert_equal(:swf, MediaFile.open("test/files/compressed.swf").file_ext)
end
should "not fail for empty files" do
assert_equal(:bin, MediaFile.open("test/files/test-empty.bin").file_ext)
end
end
should "determine the correct md5 for a jpeg file" do