Skip to content

Commit 23d5ac5

Browse files
committed
Check if filename is a guid and replace with menu item name
1 parent 0d3c0d9 commit 23d5ac5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

static/build_theme.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ <h1>Bruce Theme Builder</h1>
866866

867867
const baseName = file.name.substring(0, file.name.lastIndexOf(".")) || file.name;
868868
const blob = await fetch(imageDataUrl).then(res => res.blob());
869-
const fileName = `${baseName}.${fileExtension}`;
869+
const fileName = isGuid(baseName) ? `${name}.${fileExtension}` : `${baseName}.${fileExtension}`;
870870
jsonMapping[name] = fileName;
871871
imageFolder.file(fileName, blob);
872872
totalProcessed++;
@@ -1026,6 +1026,11 @@ <h1>Bruce Theme Builder</h1>
10261026
});
10271027
}
10281028

1029+
function isGuid(str) {
1030+
const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
1031+
return guidRegex.test(str);
1032+
}
1033+
10291034
createFileInputs();
10301035
setupDragAndDrop();
10311036
updateColorDisplay();

0 commit comments

Comments
 (0)