Skip to content

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

fix: Failed to construct 'URL': Invalid base URL

Ramesh Mane309695b6b49c
diff --git a/packages/nc-gui/components/smartsheet/details/Api.vue b/packages/nc-gui/components/smartsheet/details/Api.vue
index 8092c197e9..b3220000a6 100644
--- a/packages/nc-gui/components/smartsheet/details/Api.vue
+++ b/packages/nc-gui/components/smartsheet/details/Api.vue
@@ -72,9 +72,14 @@ const selectedClient = ref<string | undefined>(langs[0].clients && langs[0].clie
const selectedLangName = ref(langs[0].name)
-const apiUrl = computed(
- () => new URL(`/api/v2/tables/${meta.value?.id}/records`, (appInfo.value && appInfo.value.ncSiteUrl) || '/').href,
-)
+const apiUrl = computed(() => {
+ try {
+ return new URL(`/api/v2/tables/${meta.value?.id}/records`, (appInfo.value && appInfo.value.ncSiteUrl) || '/').href
+ } catch (e: any) {
+ console.log('Failed to construct API URL', e)
+ return ''
+ }
+})
const snippet = computed(
() =>