eslint-plugin-xss
eslint-plugin-xss copied to clipboard
Allow URL: toString() on window.location.href
Allow the use of
window.location.href = url.toString();
when url
is an instance of URL
as encoding is already handled.
See URL Standard > 6.1 URL class
See URL Standard > 6.2 URLSearchParams class
// URL with UTF-8 in path
const url = new URL('/path/шеллы', 'https://example.com');
console.log(url.toString());
// Output: "https://example.com/path/%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"
const url = new URL('/', 'https://example.com');
// Add param with UTF-8 content
url.searchParams.set('some', 'шеллы');
console.log(url.toString());
// Output: "https://example.com/?some=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"