1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 10:22:31 +01:00

improve concat output filename extension handling

This commit is contained in:
Mikael Finstad 2023-02-15 13:42:59 +08:00
parent 7abc292d37
commit 98ff495e10
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

View File

@ -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(() => {