fix: Handle sanitizeUrl can receive non-string value

closes #3746
This commit is contained in:
Tom Moor
2022-07-08 21:15:07 +02:00
parent 97f8c0813c
commit 32b7a7df00
2 changed files with 6 additions and 2 deletions

View File

@@ -77,7 +77,11 @@ export function isExternalUrl(url: string) {
* @param href The href to sanitize
* @returns The sanitized href
*/
export function sanitizeHref(href: string) {
export function sanitizeHref(href: string | null | undefined) {
if (!href) {
return undefined;
}
if (
!isUrl(href) &&
!href.startsWith("/") &&