From 7540e235a2b387ca08cf57f8942d1b190d242808 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Mon, 20 Jul 2020 05:28:27 +0900 Subject: Fix movie width and frame_rate returning nil (#14357) * Fix movie width and frame_rate returning nil * Add StreamValidationError and raise * Fix code style --- app/models/media_attachment.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models/media_attachment.rb') diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 3f2e0ceb1..3d93ec75b 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -336,6 +336,7 @@ class MediaAttachment < ApplicationRecord return unless movie.valid? + raise Mastodon::StreamValidationError, 'Video has no video stream' if movie.width.nil? || movie.frame_rate.nil? raise Mastodon::DimensionsValidationError, "#{movie.width}x#{movie.height} videos are not supported" if movie.width * movie.height > MAX_VIDEO_MATRIX_LIMIT raise Mastodon::DimensionsValidationError, "#{movie.frame_rate.to_i}fps videos are not supported" if movie.frame_rate > MAX_VIDEO_FRAME_RATE end -- cgit