Skip to content

The swiss army knife of lossless video/audio editing

improve concat output filename extension handling

Mikael Finstad98ff495e10c3
diff --git a/src/components/ConcatDialog.jsx b/src/components/ConcatDialog.jsx
index 6cb934df..92cedb87 100644
--- a/src/components/ConcatDialog.jsx
+++ b/src/components/ConcatDialog.jsx
@@ -77,7 +77,10 @@ const ConcatDialog = memo(({
return;
}
const ext = getOutFileExtension({ isCustomFormatSelected, outFormat: fileFormat, filePath: firstPath });
- setOutFileName(getSuffixedFileName(firstPath, `merged-${uniqueSuffix}${ext}`));
+ setOutFileName((existingOutputName) => {
+ if (existingOutputName == null) return getSuffixedFileName(firstPath, `merged-${uniqueSuffix}${ext}`);
+ return existingOutputName.replace(/(\.[^.]*)?$/, ext); // make sure the last (optional) .* is replaced by .ext`
+ });
}, [fileFormat, firstPath, isCustomFormatSelected, uniqueSuffix]);
const allFilesMeta = useMemo(() => {