@@ -113,7 +113,7 @@ class LinkEditor extends React.Component<Props, State> {
|
||||
|
||||
this.discardInputValue = true;
|
||||
const { from, to } = this.props;
|
||||
href = sanitizeHref(href);
|
||||
href = sanitizeHref(href) ?? "";
|
||||
|
||||
this.props.onSelectLink({ href, title, from, to });
|
||||
};
|
||||
|
||||
@@ -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("/") &&
|
||||
|
||||
Reference in New Issue
Block a user