Skip to content

Commit

Permalink
Fixed missing escaping of HTML in search highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Jul 28, 2021
1 parent fc9cfaa commit 6744eb6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 94 deletions.
29 changes: 0 additions & 29 deletions material/assets/javascripts/bundle.716f8af4.min.js

This file was deleted.

7 changes: 0 additions & 7 deletions material/assets/javascripts/bundle.716f8af4.min.js.map

This file was deleted.

48 changes: 0 additions & 48 deletions material/assets/javascripts/workers/search.53c85856.min.js

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions material/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h1>{{ page.title | d(config.site_name, true)}}</h1>
"base": base_url,
"features": features,
"translations": {},
"search": "assets/javascripts/workers/search.53c85856.min.js" | url,
"search": "assets/javascripts/workers/search.709b4209.min.js" | url,
"version": config.extra.version or None
} -%}
{%- set translations = app.translations -%}
Expand All @@ -223,7 +223,7 @@ <h1>{{ page.title | d(config.site_name, true)}}</h1>
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.716f8af4.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.2b46852b.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* IN THE SOFTWARE.
*/

import escapeHTML from "escape-html"

import { SearchIndexConfig } from "../_"

/* ----------------------------------------------------------------------------
Expand Down Expand Up @@ -77,7 +79,7 @@ export function setupSearchHighlighter(
})`, "img")

/* Highlight string value */
return value => value
return value => escapeHTML(value)
.replace(match, highlight)
.replace(/<\/mark>(\s+)<mark[^>]*>/img, "$1")
}
Expand Down

0 comments on commit 6744eb6

Please sign in to comment.