diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/videos/captions.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 05412a17f..4cf8de1ef 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts | |||
@@ -9,11 +9,10 @@ import { createReqFiles } from '../../../helpers/express-utils' | |||
9 | import { CONFIG, sequelizeTypescript, VIDEO_CAPTIONS_MIMETYPE_EXT } from '../../../initializers' | 9 | import { CONFIG, sequelizeTypescript, VIDEO_CAPTIONS_MIMETYPE_EXT } from '../../../initializers' |
10 | import { getFormattedObjects } from '../../../helpers/utils' | 10 | import { getFormattedObjects } from '../../../helpers/utils' |
11 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 11 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
12 | import { renamePromise } from '../../../helpers/core-utils' | ||
13 | import { join } from 'path' | ||
14 | import { VideoModel } from '../../../models/video/video' | 12 | import { VideoModel } from '../../../models/video/video' |
15 | import { logger } from '../../../helpers/logger' | 13 | import { logger } from '../../../helpers/logger' |
16 | import { federateVideoIfNeeded } from '../../../lib/activitypub' | 14 | import { federateVideoIfNeeded } from '../../../lib/activitypub' |
15 | import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' | ||
17 | 16 | ||
18 | const reqVideoCaptionAdd = createReqFiles( | 17 | const reqVideoCaptionAdd = createReqFiles( |
19 | [ 'captionfile' ], | 18 | [ 'captionfile' ], |
@@ -66,12 +65,7 @@ async function addVideoCaption (req: express.Request, res: express.Response) { | |||
66 | videoCaption.Video = video | 65 | videoCaption.Video = video |
67 | 66 | ||
68 | // Move physical file | 67 | // Move physical file |
69 | const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR | 68 | await moveAndProcessCaptionFile(videoCaptionPhysicalFile, videoCaption) |
70 | const destination = join(videoCaptionsDir, videoCaption.getCaptionName()) | ||
71 | await renamePromise(videoCaptionPhysicalFile.path, destination) | ||
72 | // This is important in case if there is another attempt in the retry process | ||
73 | videoCaptionPhysicalFile.filename = videoCaption.getCaptionName() | ||
74 | videoCaptionPhysicalFile.path = destination | ||
75 | 69 | ||
76 | await sequelizeTypescript.transaction(async t => { | 70 | await sequelizeTypescript.transaction(async t => { |
77 | await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, t) | 71 | await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, t) |