diff --git a/website/src/scripts/utils.ts b/website/src/scripts/utils.ts index 7e1f861b..07f54d3d 100644 --- a/website/src/scripts/utils.ts +++ b/website/src/scripts/utils.ts @@ -298,7 +298,8 @@ export function setupDropdownCloseHandlers(): void { export function getActionButtonsHtml(filePath: string, small = false): string { const btnClass = small ? 'btn-small' : ''; const iconSize = small ? 14 : 16; - const escapedPath = filePath.replace(/'/g, "\\'"); + // Escape backslashes first, then single quotes to prevent breaking out of string context + const escapedPath = filePath.replace(/\\/g, '\\\\').replace(/'/g, "\\'"); return `