X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideo-imports.ts;h=dbf6a3504a9aa8e9b67009e488eb207fa3a0840b;hb=c4fa01f7c45b66b112ebd08abce744b7c4041feb;hp=3ad7a464800918382ff2b1d8e1b825b5ee9c2bb5;hpb=76148b27f7501bac061992136852be4303370c8d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/video-imports.ts b/server/helpers/custom-validators/video-imports.ts index 3ad7a4648..dbf6a3504 100644 --- a/server/helpers/custom-validators/video-imports.ts +++ b/server/helpers/custom-validators/video-imports.ts @@ -2,9 +2,6 @@ import 'multer' import validator from 'validator' import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants' import { exists, isFileValid } from './misc' -import * as express from 'express' -import { VideoImportModel } from '../../models/video/video-import' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' function isVideoImportTargetUrlValid (url: string) { const isURLOptions = { @@ -32,26 +29,10 @@ function isVideoImportTorrentFile (files: { [ fieldname: string ]: Express.Multe return isFileValid(files, videoTorrentImportRegex, 'torrentfile', CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_FILE.FILE_SIZE.max, true) } -async function doesVideoImportExist (id: number, res: express.Response) { - const videoImport = await VideoImportModel.loadAndPopulateVideo(id) - - if (!videoImport) { - res.fail({ - status: HttpStatusCode.NOT_FOUND_404, - message: 'Video import not found' - }) - return false - } - - res.locals.videoImport = videoImport - return true -} - // --------------------------------------------------------------------------- export { isVideoImportStateValid, isVideoImportTargetUrlValid, - doesVideoImportExist, isVideoImportTorrentFile }