Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html search: use a Map to collect file-term scores #13060

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ Features added
Bugs fixed
----------

* #13060: HTML Search: use ``Map`` instead of object literal to store
per-file term scores, to prevent prototype pollution.
Patch by James Addison
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved

Testing
-------
2 changes: 1 addition & 1 deletion sphinx/themes/basic/static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ const Search = {

// set score for the word in each file
recordFiles.forEach((file) => {
if (!scoreMap.has(file)) scoreMap.set(file, {});
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
scoreMap.get(file)[word] = record.score;
jayaddison marked this conversation as resolved.
Show resolved Hide resolved
});
});
Expand Down
Loading