Skip to content

Commit c24f7f6

Browse files
fix: Add escapeHtml for search (#1551)
Co-authored-by: Anix <[email protected]>
1 parent 32203b7 commit c24f7f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/plugins/search/search.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export function search(query) {
178178
keywords.forEach(keyword => {
179179
// From https://github.com/sindresorhus/escape-string-regexp
180180
const regEx = new RegExp(
181-
ignoreDiacriticalMarks(keyword).replace(
181+
escapeHtml(ignoreDiacriticalMarks(keyword)).replace(
182182
/[|\\{}()[\]^$+*?.]/g,
183183
'\\$&'
184184
),
@@ -187,10 +187,10 @@ export function search(query) {
187187
let indexTitle = -1;
188188
let indexContent = -1;
189189
handlePostTitle = postTitle
190-
? ignoreDiacriticalMarks(postTitle)
190+
? escapeHtml(ignoreDiacriticalMarks(postTitle))
191191
: postTitle;
192192
handlePostContent = postContent
193-
? ignoreDiacriticalMarks(postContent)
193+
? escapeHtml(ignoreDiacriticalMarks(postContent))
194194
: postContent;
195195

196196
indexTitle = postTitle ? handlePostTitle.search(regEx) : -1;

0 commit comments

Comments
 (0)