chore: normalize brace suffix in reprocess base names

This commit is contained in:
chris 2025-12-08 15:59:34 -05:00
parent a94d938131
commit cf575afc3f

View File

@ -60,8 +60,11 @@ const isHeifBuffer = (buffer) => buffer && buffer.length >= 12 && HEIF_BRANDS.ha
function parseBaseName(doc) { function parseBaseName(doc) {
const raw = path.basename(doc.filename || doc.path || '', path.extname(doc.filename || doc.path || '')); const raw = path.basename(doc.filename || doc.path || '', path.extname(doc.filename || doc.path || ''));
// Strip any trailing brace artifacts from older filenames
const cleaned = raw.endsWith('}') ? raw.slice(0, -1) : raw;
const match = raw.match(/^(.*?)(-md|-sm)?$/); const match = raw.match(/^(.*?)(-md|-sm)?$/);
return match ? match[1] : raw; const base = match ? match[1] : raw;
return cleaned !== raw ? cleaned : base;
} }
function sourceCandidates(doc) { function sourceCandidates(doc) {