diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
commit | 62689b942b71cd1dd0d050c6ed05f884a0b325c2 (patch) | |
tree | c45c35d35d7a3e32621fba06edc63646930c8efd /server/controllers/api/videos/import.ts | |
parent | 84b6dbcc6e8654f39ec798905e1151ba915cd1aa (diff) | |
download | PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.gz PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.zst PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.zip |
Correctly migrate to fs-extra
Diffstat (limited to 'server/controllers/api/videos/import.ts')
-rw-r--r-- | server/controllers/api/videos/import.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index b2f73fa48..44f15ef74 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -27,8 +27,8 @@ import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model' | |||
27 | import { VideoChannelModel } from '../../../models/video/video-channel' | 27 | import { VideoChannelModel } from '../../../models/video/video-channel' |
28 | import * as Bluebird from 'bluebird' | 28 | import * as Bluebird from 'bluebird' |
29 | import * as parseTorrent from 'parse-torrent' | 29 | import * as parseTorrent from 'parse-torrent' |
30 | import { readFileBufferPromise, renamePromise } from '../../../helpers/core-utils' | ||
31 | import { getSecureTorrentName } from '../../../helpers/utils' | 30 | import { getSecureTorrentName } from '../../../helpers/utils' |
31 | import { readFile, rename } from 'fs-extra' | ||
32 | 32 | ||
33 | const auditLogger = auditLoggerFactory('video-imports') | 33 | const auditLogger = auditLoggerFactory('video-imports') |
34 | const videoImportsRouter = express.Router() | 34 | const videoImportsRouter = express.Router() |
@@ -78,10 +78,10 @@ async function addTorrentImport (req: express.Request, res: express.Response, to | |||
78 | 78 | ||
79 | // Rename the torrent to a secured name | 79 | // Rename the torrent to a secured name |
80 | const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, getSecureTorrentName(torrentName)) | 80 | const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, getSecureTorrentName(torrentName)) |
81 | await renamePromise(torrentfile.path, newTorrentPath) | 81 | await rename(torrentfile.path, newTorrentPath) |
82 | torrentfile.path = newTorrentPath | 82 | torrentfile.path = newTorrentPath |
83 | 83 | ||
84 | const buf = await readFileBufferPromise(torrentfile.path) | 84 | const buf = await readFile(torrentfile.path) |
85 | const parsedTorrent = parseTorrent(buf) | 85 | const parsedTorrent = parseTorrent(buf) |
86 | 86 | ||
87 | videoName = isArray(parsedTorrent.name) ? parsedTorrent.name[ 0 ] : parsedTorrent.name as string | 87 | videoName = isArray(parsedTorrent.name) ? parsedTorrent.name[ 0 ] : parsedTorrent.name as string |