X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-caption.ts;h=b4f17b481c8320dcc1e42ec6b801cf609621e47f;hb=156c50af3085468a47b8ae73fe8cfcae46b42398;hp=3593646a2ca1a857ed45ad355aee1a5ea9b1f4c6;hpb=59c76ffa8f503e962d517c78f033f1beccb1de1a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 3593646a2..b4f17b481 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -19,7 +19,7 @@ import { VideoCaption } from '../../../shared/models/videos/caption/video-captio import { CONFIG, STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers' import { join } from 'path' import { logger } from '../../helpers/logger' -import { unlinkPromise } from '../../helpers/core-utils' +import { remove } from 'fs-extra' export enum ScopeNames { WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE' @@ -120,7 +120,8 @@ export class VideoCaptionModel extends Model { language } - return VideoCaptionModel.upsert(values, { transaction }) + return VideoCaptionModel.upsert(values, { transaction, returning: true }) + .then(([ caption ]) => caption) } static listVideoCaptions (videoId: number) { @@ -172,6 +173,6 @@ export class VideoCaptionModel extends Model { } removeCaptionFile () { - return unlinkPromise(CONFIG.STORAGE.CAPTIONS_DIR + this.getCaptionName()) + return remove(CONFIG.STORAGE.CAPTIONS_DIR + this.getCaptionName()) } }