uploads: disallow uploading new Flash files.

Flash is dead. It's no longer supported by browsers, it's not
well-supported by emulators, and only two Flash posts were uploaded in
the last year anyway. Old Flash files will continue to exist, but new
Flash uploads will no longer be allowed.
This commit is contained in:
evazion
2021-03-31 20:47:35 -05:00
parent 55980c6fbf
commit 4deb8aeea2
3 changed files with 4 additions and 4 deletions

View File

@@ -13,8 +13,8 @@ class Upload < ApplicationRecord
end
def validate_file_ext(record)
if record.file_ext == "bin"
record.errors.add(:file_ext, "is invalid (only JPEG, PNG, GIF, SWF, MP4, and WebM files are allowed")
if record.file_ext.in?(["bin", "swf"])
record.errors.add(:file_ext, "is invalid (only JPEG, PNG, GIF, MP4, and WebM files are allowed")
end
end

View File

@@ -31,7 +31,7 @@
<div class="input" id="filedropzone">
<div class="dropzone-hint">Click or drag and drop to upload a file</div>
<div class="dropzone-hint hint">Max size: <%= number_to_human_size(Danbooru.config.max_file_size) %>. Supported filetypes: jpg, png, gif, swf, mp4, webm.</div>
<div class="dropzone-hint hint">Max size: <%= number_to_human_size(Danbooru.config.max_file_size) %>. Supported filetypes: jpg, png, gif, mp4, webm.</div>
</div>
<div class="input string optional upload_source">

View File

@@ -287,7 +287,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/compressed.swf")
# should_upload_successfully("test/files/compressed.swf")
end
context "uploading a file from a source" do