hash_util: Encode url component derived from browser.

This is for security reasons.
This commit is contained in:
Aman Agrawal 2021-11-27 08:46:26 +00:00 committed by Tim Abbott
parent 7713b371a5
commit 64020c2358
2 changed files with 2 additions and 2 deletions

View File

@ -208,5 +208,5 @@ run_test("test_search_public_streams_notice_url", () => {
run_test("test_current_hash_as_next", () => {
window.location.hash = "#foo";
assert.equal(hash_util.current_hash_as_next(), "next=/#foo");
assert.equal(hash_util.current_hash_as_next(), "next=/%23foo");
});

View File

@ -310,5 +310,5 @@ export function is_spectator_compatible(hash) {
}
export function current_hash_as_next() {
return `next=/${window.location.hash}`;
return `next=/${encodeURIComponent(window.location.hash)}`;
}