This commit is contained in:
Simon Knott 2025-02-26 15:35:21 +01:00
parent 106c8cef01
commit 8d2270e4ac
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -206,7 +206,8 @@ export function addSuffixToFilePath(filePath: string, suffix: string): string {
return base + suffix + ext;
}
export function sanitizeFilePathBeforeExtension(filePath: string, ext = path.extname(filePath)): string {
export function sanitizeFilePathBeforeExtension(filePath: string, ext?: string): string {
ext ??= path.extname(filePath);
const base = filePath.substring(0, filePath.length - ext.length);
return sanitizeForFilePath(base) + ext;
}