From 3e17515e2996b79e23f569c296051a91af3fcbe4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 7 Aug 2018 15:17:17 +0200 Subject: Add torrent tests --- server/controllers/api/videos/import.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/controllers/api/videos/import.ts') diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 94dafcdbd..b2f73fa48 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -97,7 +97,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to await processThumbnail(req, video) await processPreview(req, video) - const tags = null + const tags = body.tags || undefined const videoImportAttributes = { magnetUri, torrentName, @@ -224,11 +224,13 @@ function insertIntoDB ( videoCreated.VideoChannel = videoChannel // Set tags to the video - if (tags !== undefined) { + if (tags) { const tagInstances = await TagModel.findOrCreateTags(tags, t) await videoCreated.$set('Tags', tagInstances, sequelizeOptions) videoCreated.Tags = tagInstances + } else { + videoCreated.Tags = [] } // Create video import object in database -- cgit v1.2.3