]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't move the caption if it has the right name
authorChocobozzz <me@florianbigard.com>
Tue, 3 Dec 2019 09:10:14 +0000 (10:10 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 3 Dec 2019 09:10:14 +0000 (10:10 +0100)
server/controllers/api/videos/index.ts
server/helpers/captions-utils.ts

index 78948ff249fc54665858b32497bd337ba79a99df..337795541c309821291614944faa4dbf40825808 100644 (file)
@@ -1,5 +1,5 @@
 import * as express from 'express'
-import { extname, join } from 'path'
+import { extname } from 'path'
 import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../shared'
 import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
 import { logger } from '../../../helpers/logger'
@@ -65,7 +65,7 @@ import { VideoTranscodingPayload } from '../../../lib/job-queue/handlers/video-t
 import { Hooks } from '../../../lib/plugins/hooks'
 import { MVideoDetails, MVideoFullLight } from '@server/typings/models'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
-import { getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
+import { getVideoFilePath } from '@server/lib/video-paths'
 
 const auditLogger = auditLoggerFactory('videos')
 const videosRouter = express.Router()
index 2830ae01776a3cef82883f302d2510a32ea26f9e..73b6d166d978915da7de8b0dcffbceb5d49a3f71 100644 (file)
@@ -12,7 +12,7 @@ async function moveAndProcessCaptionFile (physicalFile: { filename: string, path
   if (physicalFile.path.endsWith('.srt')) {
     await convertSrtToVtt(physicalFile.path, destination)
     await remove(physicalFile.path)
-  } else { // Just move the vtt file
+  } else if (physicalFile.path !== destination) { // Just move the vtt file
     await move(physicalFile.path, destination, { overwrite: true })
   }