fix(bulk-context-menu): escape special characters in data-filepath selector to support double quotes in filenames (#845)

This commit is contained in:
Will Miao
2026-03-12 08:49:10 +08:00
parent 5c29e26c4e
commit 4fcf641d57
7 changed files with 34 additions and 10 deletions

View File

@@ -201,8 +201,9 @@ class RecipeCard {
this.recipe.favorite = isFavorite;
// Re-find star icon in case of re-render during fault
const filePathForXpath = this.recipe.file_path.replace(/"/g, '"');
const currentCard = card.ownerDocument.evaluate(
`.//*[@data-filepath="${this.recipe.file_path}"]`,
`.//*[@data-filepath="${filePathForXpath}"]`,
card.ownerDocument, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null
).singleNodeValue || card;