X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fyoutube-dl.ts;h=3a9e57561426372564c4848b99741d207410b55f;hb=3b01f4c0ac764ecb70efaadfd939ca868c28769c;hp=6b9d8a5f78066626498fd06d08aa0b4e0b55c888;hpb=805b8619c1b8c56e08c927d93293c06e1075b50d;p=github%2FChocobozzz%2FPeerTube.git 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 @@ import { createWriteStream } from 'fs' -import { ensureDir, pathExists, remove, writeFile } from 'fs-extra' +import { ensureDir, move, pathExists, remove, writeFile } from 'fs-extra' import { join } from 'path' import * as request from 'request' import { CONFIG } from '@server/initializers/config' @@ -147,6 +147,11 @@ function downloadYoutubeDLVideo (url: string, fileExt: string, timeout: number) clearTimeout(timer) try { + // If youtube-dl did not guess an extension for our file, just use .mp4 as default + if (await pathExists(pathWithoutExtension)) { + await move(pathWithoutExtension, pathWithoutExtension + '.mp4') + } + const path = await guessVideoPathWithExtension(pathWithoutExtension, fileExt) if (err) {