From 99b757488c077cee7d0ab89eeec181a7ee6290eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Nov 2022 15:00:19 +0100 Subject: Fix server lint --- server/lib/job-queue/handlers/activitypub-cleaner.ts | 2 +- server/lib/job-queue/handlers/video-import.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'server/lib/job-queue/handlers') diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 84c0a2de2..a25f00b0a 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts @@ -88,7 +88,7 @@ async function updateObjectIfNeeded (options: { const { body } = await doJSONRequest(url, { activityPub: true }) // If not same id, check same host and update - if (!body || !body.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`) + if (!body?.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`) if (body.type === 'Tombstone') { return on404OrTombstone() diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 83d582cb4..4d361c7b9 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -107,7 +107,7 @@ async function processYoutubeDLImport (job: Job, videoImport: MVideoImportDefaul async function getVideoImportOrDie (payload: VideoImportPayload) { const videoImport = await VideoImportModel.loadAndPopulateVideo(payload.videoImportId) - if (!videoImport || !videoImport.Video) { + if (!videoImport?.Video) { throw new Error(`Cannot import video ${payload.videoImportId}: the video import or video linked to this import does not exist anymore.`) } -- cgit v1.2.3