From 9aeef9aafa009762e128046bfb2f3cec3252e181 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Feb 2021 16:14:12 +0100 Subject: Check video UUID in args scripts --- scripts/create-import-video-file-job.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/create-import-video-file-job.ts') diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts index f5271c7a3..5d38af066 100644 --- a/scripts/create-import-video-file-job.ts +++ b/scripts/create-import-video-file-job.ts @@ -6,6 +6,7 @@ import { resolve } from 'path' import { VideoModel } from '../server/models/video/video' import { initDatabaseModels } from '../server/initializers/database' import { JobQueue } from '../server/lib/job-queue' +import { isUUIDValid } from '@server/helpers/custom-validators/misc' program .option('-v, --video [videoUUID]', 'Video UUID') @@ -30,6 +31,11 @@ run() async function run () { await initDatabaseModels(true) + if (isUUIDValid(options.video) === false) { + console.error('%s is not a valid video UUID.', options.video) + return + } + const video = await VideoModel.loadByUUID(options.video) if (!video) throw new Error('Video not found.') if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') -- cgit v1.2.3