From 6d6cd57b6f41ac641162777cf1e1c669a4b65675 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 24 Feb 2023 10:11:45 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/7466 --- app/src/history/history.ts | 4 ++-- app/src/util/escape.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/history/history.ts b/app/src/history/history.ts index d1c2b5c3b..b07eb8321 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -7,7 +7,7 @@ import {Protyle} from "../protyle"; import {disabledProtyle, onGet} from "../protyle/util/onGet"; import * as dayjs from "dayjs"; import {fetchPost} from "../util/fetch"; -import {escapeHtml} from "../util/escape"; +import {escapeAttr, escapeHtml} from "../util/escape"; import {isMobile} from "../util/functions"; import {showDiff} from "./diff"; import {setStorageVal} from "../protyle/util/compatibility"; @@ -432,7 +432,7 @@ export const openHistory = () => { iconElement.classList.add("b3-list-item__arrow--open"); let html = ""; response.data.items.forEach((docItem: { title: string, path: string }) => { - html += `
  • + html += `
  • ${escapeHtml(docItem.title)} diff --git a/app/src/util/escape.ts b/app/src/util/escape.ts index dfb261845..b1f15839b 100644 --- a/app/src/util/escape.ts +++ b/app/src/util/escape.ts @@ -1,3 +1,7 @@ export const escapeHtml = (html: string) => { return html.replace(/&/g, "&").replace(/ { + return html.replace(/"/g, """).replace(/'/g, "'"); +};