fix(TypeError): Failed to construct 'URL': Invalid base URL

This commit is contained in:
Ramesh Mane
2026-01-17 10:29:19 +00:00
parent 5dcfb10d44
commit a7a43bdf98

View File

@@ -110,8 +110,13 @@ export function getFormulaTextSegments(anchorLinkHTML: string) {
}
export const openLink = (path: string, baseURL?: string, target = '_blank') => {
const url = new URL(path, baseURL)
window.open(url.href, target, 'noopener,noreferrer')
try {
const url = new URL(path, baseURL)
window.open(url.href, target, 'noopener,noreferrer')
} catch (e) {
console.error(`Failed constructing URL'${path}'`, e)
message.error((e as Error)?.message || 'Failed to construct URL')
}
}
export const navigateToBlankTargetOpenOption = {