( url: string, webappHost = getWebappHost(), )
| 13 | // only rendered when it is an http(s) URL on our own webapp. React would |
| 14 | // happily render a `javascript:` href. |
| 15 | export const getSafeCommentUrl = ( |
| 16 | url: string, |
| 17 | webappHost = getWebappHost(), |
| 18 | ): string | undefined => { |
| 19 | if (!webappHost || !isValidHttpUrl(url)) { |
| 20 | return undefined; |
| 21 | } |
| 22 | |
| 23 | return new URL(url).host === webappHost ? url : undefined; |
| 24 | }; |
no test coverage detected