Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

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

Ramesh Manea7a43bdf98a8
diff --git a/packages/nc-gui/utils/urlUtils.ts b/packages/nc-gui/utils/urlUtils.ts
index 8eed17ae10..fa93588213 100644
--- a/packages/nc-gui/utils/urlUtils.ts
+++ b/packages/nc-gui/utils/urlUtils.ts
@@ -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 = {