Skip to content

Commit

Permalink
fix: rename empty filenames [#36]
Browse files Browse the repository at this point in the history
  • Loading branch information
garzj committed Jun 23, 2024
1 parent 2b3ea06 commit 22fb904
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/media/save-to-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ export async function saveToDir(
saveBase?: string,
): Promise<string> {
saveBase = saveBase ?? basename(file);
const sanitized = sanitize(saveBase, { replacement: '_' });
let sanitized = sanitize(saveBase, { replacement: '_' });
if (sanitized === '') {
sanitized = '_';
}
if (saveBase != sanitized) {
migCtx.warnLog(`Sanitized file: ${file}` + '\nNew filename: ${sanitized}');
migCtx.warnLog(`Sanitized file: ${file}` + ` (New filename: ${sanitized})`);
}

const lcBase = saveBase.toLowerCase();
Expand Down

0 comments on commit 22fb904

Please sign in to comment.