fix: handle dotted reserved snapshot names

This commit is contained in:
Affaan Mustafa authored and Affaan Mustafa committed 2026-04-30 12:25:14 -04:00
1 parent 61992f7f5e
commit 841beea45c
2 files changed
+19 -7

No files matched your search

+6 -1
View File
@@ -626,7 +626,12 @@ function sanitizeSnapshotName(value, fallback = 'session') {
return sanitized;
}
if (sanitized && isWindowsReservedBasename(sanitized)) {
return `${sanitized}-${hashString(raw).slice(0, 8)}`;
const firstDotIndex = sanitized.indexOf('.');
const hashSuffix = hashString(raw).slice(0, 8);
if (firstDotIndex === -1) {
return `${sanitized}-${hashSuffix}`;
}
return `${sanitized.slice(0, firstDotIndex)}-${hashSuffix}${sanitized.slice(firstDotIndex)}`;
}
const prefix = sanitized ? sanitized.slice(0, 48).replace(/[._-]+$/g, '') : fallback;