The swiss army knife of lossless video/audio editing
Only use a plain extension from an attachment's file name
Claude4a298e3235bb
diff --git a/src/renderer/src/hooks/useFfmpegOperations.ts b/src/renderer/src/hooks/useFfmpegOperations.tsindex 84da452f..0ae3963a 100644--- a/src/renderer/src/hooks/useFfmpegOperations.ts+++ b/src/renderer/src/hooks/useFfmpegOperations.ts@@ -1101,8 +1101,10 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trealet streamArgs: string[] = [];const outPaths = await pMap(streams, async ({ index, codec_name: codec, codec_type: type, tags }) => {- // Attachments like fonts often have no codec_name, so take the extension from the attachment's file name- const ext = codec || extname(tags?.['filename'] ?? '').slice(1) || 'bin';+ // Attachments like XML files have no codec_name, so take the extension from the attachment's file name+ // (it comes from the file, so only accept a plain extension, e.g. not `tt:f` on Windows)+ const nameExt = extname(tags?.['filename'] ?? '').slice(1).toLowerCase();+ const ext = codec || (/^[\da-z]{1,10}$/.test(nameExt) ? nameExt : 'bin');const outPath = getSuffixedOutPath({ customOutDir, filePath, nameSuffix: `stream-${index}-${type}${codec ? `-${codec}` : ''}.${ext}` });invariant(outPath != null);if (!enableOverwriteOutput && await mainApi.pathExists(outPath)) throw new RefuseOverwriteError();