diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-20 08:45:21 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-20 08:45:21 +0100 |
commit | 86f553fbdfb18750e8d7b7bc5094316a428679b7 (patch) | |
tree | 0fd5d8aa251e6d3d11675e5d6a1adb4b774d9dcf /server/helpers | |
parent | 805b8619c1b8c56e08c927d93293c06e1075b50d (diff) | |
download | PeerTube-86f553fbdfb18750e8d7b7bc5094316a428679b7.tar.gz PeerTube-86f553fbdfb18750e8d7b7bc5094316a428679b7.tar.zst PeerTube-86f553fbdfb18750e8d7b7bc5094316a428679b7.zip |
Fix raw file import
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/youtube-dl.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 6b9d8a5f7..3a9e57561 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { createWriteStream } from 'fs' | 1 | import { createWriteStream } from 'fs' |
2 | import { ensureDir, pathExists, remove, writeFile } from 'fs-extra' | 2 | import { ensureDir, move, pathExists, remove, writeFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import * as request from 'request' | 4 | import * as request from 'request' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
@@ -147,6 +147,11 @@ function downloadYoutubeDLVideo (url: string, fileExt: string, timeout: number) | |||
147 | clearTimeout(timer) | 147 | clearTimeout(timer) |
148 | 148 | ||
149 | try { | 149 | try { |
150 | // If youtube-dl did not guess an extension for our file, just use .mp4 as default | ||
151 | if (await pathExists(pathWithoutExtension)) { | ||
152 | await move(pathWithoutExtension, pathWithoutExtension + '.mp4') | ||
153 | } | ||
154 | |||
150 | const path = await guessVideoPathWithExtension(pathWithoutExtension, fileExt) | 155 | const path = await guessVideoPathWithExtension(pathWithoutExtension, fileExt) |
151 | 156 | ||
152 | if (err) { | 157 | if (err) { |