aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-11 15:12:38 +0100
committerChocobozzz <me@florianbigard.com>2018-12-11 15:12:38 +0100
commitf481c4f9f31e897a08e818f388fecdee07f57142 (patch)
tree2a47adb746d7bfc5046fa7e610408223c921db83 /server/controllers
parent14e2014acc1362cfbb770c051a7254b156cd8efb (diff)
downloadPeerTube-f481c4f9f31e897a08e818f388fecdee07f57142.tar.gz
PeerTube-f481c4f9f31e897a08e818f388fecdee07f57142.tar.zst
PeerTube-f481c4f9f31e897a08e818f388fecdee07f57142.zip
Use move instead rename
To avoid EXDEV errors
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/import.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 099ab7b8d..98366cd82 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -21,7 +21,7 @@ import { VideoChannelModel } from '../../../models/video/video-channel'
21import * as Bluebird from 'bluebird' 21import * as Bluebird from 'bluebird'
22import * as parseTorrent from 'parse-torrent' 22import * as parseTorrent from 'parse-torrent'
23import { getSecureTorrentName } from '../../../helpers/utils' 23import { getSecureTorrentName } from '../../../helpers/utils'
24import { readFile, rename } from 'fs-extra' 24import { readFile, move } from 'fs-extra'
25 25
26const auditLogger = auditLoggerFactory('video-imports') 26const auditLogger = auditLoggerFactory('video-imports')
27const videoImportsRouter = express.Router() 27const videoImportsRouter = express.Router()
@@ -71,7 +71,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
71 71
72 // Rename the torrent to a secured name 72 // Rename the torrent to a secured name
73 const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, getSecureTorrentName(torrentName)) 73 const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, getSecureTorrentName(torrentName))
74 await rename(torrentfile.path, newTorrentPath) 74 await move(torrentfile.path, newTorrentPath)
75 torrentfile.path = newTorrentPath 75 torrentfile.path = newTorrentPath
76 76
77 const buf = await readFile(torrentfile.path) 77 const buf = await readFile(torrentfile.path)