From 15bd5f73b305d1b5c5fac6e276f3c79b8880372d Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Wed, 29 Dec 2021 14:23:43 +0100 Subject: [PATCH] Fix duration check for uploads from twitter Some twitter videos near the max duration had some stray milliseconds that made the check fail. For example https://twitter.com/kivo_some_18/status/1152167154059321344?s=20 (nsfw) has 140.053333 duration. --- app/models/upload.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index 069d2949d..d20748c75 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -55,7 +55,7 @@ class Upload < ApplicationRecord end def validate_video_duration(record) - if !record.uploader.is_admin? && record.file.is_video? && record.file.duration > MAX_VIDEO_DURATION + if !record.uploader.is_admin? && record.file.is_video? && record.file.duration.to_i > MAX_VIDEO_DURATION record.errors.add(:base, "video must not be longer than #{MAX_VIDEO_DURATION.seconds.inspect}") end end