From ee765a6d229b2488abb84235a69c766a41ffe37c Mon Sep 17 00:00:00 2001 From: Will Miao Date: Wed, 11 Mar 2026 23:33:11 +0800 Subject: [PATCH] fix(sidebar): escape folder names and paths to support double quotes - Import and use escapeHtml and escapeAttribute in SidebarManager.js - Escape data-path and title attributes in folder tree and breadcrumbs - Use CSS.escape() for attribute selectors in updateTreeSelection - Fixes issue #843 where folders with double quotes broke navigation --- static/js/components/SidebarManager.js | 55 ++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/static/js/components/SidebarManager.js b/static/js/components/SidebarManager.js index 6c53dd28..a4805dce 100644 --- a/static/js/components/SidebarManager.js +++ b/static/js/components/SidebarManager.js @@ -7,6 +7,7 @@ import { translate } from '../utils/i18nHelpers.js'; import { state } from '../state/index.js'; import { bulkManager } from '../managers/BulkManager.js'; import { showToast } from '../utils/uiHelpers.js'; +import { escapeHtml, escapeAttribute } from './shared/utils.js'; export class SidebarManager { constructor() { @@ -1294,15 +1295,19 @@ export class SidebarManager { const isExpanded = this.expandedNodes.has(currentPath); const isSelected = this.selectedPath === currentPath; + const escapedPath = escapeAttribute(currentPath); + const escapedFolderName = escapeHtml(folderName); + const escapedTitle = escapeAttribute(folderName); + return ` -