Percent-encode URL path when reporting spam

This commit is contained in:
Evan Hahn 2023-01-19 13:53:04 -06:00 committed by GitHub
parent 6ddb12cd99
commit 7f0ed2599d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 3 deletions

View file

@ -33,3 +33,9 @@ function cloneUrl(url: Readonly<URL>): URL {
function stringifySearchParamValue(value: unknown): string {
return value == null ? '' : String(value);
}
export function urlPathFromComponents(
components: ReadonlyArray<string>
): string {
return `/${components.filter(Boolean).map(encodeURIComponent).join('/')}`;
}