Merge branch 'develop' into pr/1217
[oweals/peertube.git] / server / controllers / api / videos / import.ts
index 099ab7b8d6aafb07b0fcdc18cb1e25dc6f6f93bf..7053d5253c9bc89f56412f38516480ac29edb8ab 100644 (file)
@@ -21,7 +21,7 @@ import { VideoChannelModel } from '../../../models/video/video-channel'
 import * as Bluebird from 'bluebird'
 import * as parseTorrent from 'parse-torrent'
 import { getSecureTorrentName } from '../../../helpers/utils'
-import { readFile, rename } from 'fs-extra'
+import { readFile, move } from 'fs-extra'
 
 const auditLogger = auditLoggerFactory('video-imports')
 const videoImportsRouter = express.Router()
@@ -71,7 +71,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
 
     // Rename the torrent to a secured name
     const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, getSecureTorrentName(torrentName))
-    await rename(torrentfile.path, newTorrentPath)
+    await move(torrentfile.path, newTorrentPath)
     torrentfile.path = newTorrentPath
 
     const buf = await readFile(torrentfile.path)
@@ -164,6 +164,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
     licence: body.licence || importData.licence,
     language: body.language || undefined,
     commentsEnabled: body.commentsEnabled || true,
+    downloadEnabled: body.downloadEnabled || true,
     waitTranscoding: body.waitTranscoding || false,
     state: VideoState.TO_IMPORT,
     nsfw: body.nsfw || importData.nsfw || false,