From 965c4b22d0e4d2f853501e844e6ebbb861bd389d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 Aug 2018 11:24:36 +0200 Subject: Use height instead of width to represent the video resolution --- server/helpers/custom-validators/activitypub/videos.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 702c09842..0362f43ab 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -148,22 +148,25 @@ function setRemoteVideoTruncatedContent (video: any) { } function isRemoteVideoUrlValid (url: any) { + // FIXME: Old bug, we used the width to represent the resolution. Remove it in a few realease (currently beta.11) + if (url.width && !url.height) url.height = url.width + return url.type === 'Link' && ( ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 && isActivityPubUrlValid(url.href) && - validator.isInt(url.width + '', { min: 0 }) && + validator.isInt(url.height + '', { min: 0 }) && validator.isInt(url.size + '', { min: 0 }) && (!url.fps || validator.isInt(url.fps + '', { min: 0 })) ) || ( ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 && isActivityPubUrlValid(url.href) && - validator.isInt(url.width + '', { min: 0 }) + validator.isInt(url.height + '', { min: 0 }) ) || ( ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 && validator.isLength(url.href, { min: 5 }) && - validator.isInt(url.width + '', { min: 0 }) + validator.isInt(url.height + '', { min: 0 }) ) } -- cgit v1.2.3