uploads: allow uploading .m4v format videos.

Fix not being able to upload .m4v format videos as reported here:

* https://danbooru.donmai.us/forum_posts/205248
* https://github.com/danbooru/danbooru/issues/3615#issuecomment-1030950924

From https://en.wikipedia.org/wiki/M4V:

  The M4V file format is a video container format developed by Apple and
  is very similar to the MP4 format. The primary difference is that M4V
  files may optionally be protected by DRM copy protection.

This could be a problem if it allows uploading videos that are
unplayable because of DRM.
This commit is contained in:
evazion
2022-02-06 21:29:57 -06:00
parent 7bed81812d
commit 572878fb0d
4 changed files with 13 additions and 1 deletions

BIN
test/files/test-audio.m4v Normal file

Binary file not shown.

View File

@@ -261,6 +261,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
should_upload_successfully("test/files/test-animated-86x52.gif")
should_upload_successfully("test/files/test-300x300.mp4")
should_upload_successfully("test/files/test-512x512.webm")
should_upload_successfully("test/files/test-audio.m4v")
# should_upload_successfully("test/files/compressed.swf")
end

View File

@@ -93,6 +93,10 @@ class MediaFileTest < ActiveSupport::TestCase
assert_equal(:mp4, MediaFile.open("test/files/test-300x300.mp4").file_ext)
end
should "determine the correct extension for a m4v file" do
assert_equal(:mp4, MediaFile.open("test/files/test-audio.m4v").file_ext)
end
should "determine the correct extension for a ugoira file" do
assert_equal(:zip, MediaFile.open("test/files/ugoira.zip").file_ext)
end