]> cat aescling's git repositories - mastodon.git/commitdiff
Reject unprocessable audio/video files instead of keeping them unchanged
authorClaire <claire.github-309c@sitedethib.com>
Thu, 15 Jun 2023 15:35:00 +0000 (17:35 +0200)
committerClaire <claire.github-309c@sitedethib.com>
Thu, 6 Jul 2023 13:30:36 +0000 (15:30 +0200)
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lib/paperclip/transcoder.rb

index b3b55f82fb83590d95808f485fda9e4cdf200ca8..f4768aa602518c431cda2ac2cc521fa228dd7646 100644 (file)
@@ -19,10 +19,7 @@ module Paperclip
     def make
       metadata = VideoMetadataExtractor.new(@file.path)
 
-      unless metadata.valid?
-        Paperclip.log("Unsupported file #{@file.path}")
-        return File.open(@file.path)
-      end
+      raise Paperclip::Error, "Error while transcoding #{@file.path}: unsupported file" unless metadata.valid?
 
       update_attachment_type(metadata)
       update_options_from_metadata(metadata)