From 8897aad4bb24cea87bfc533656056c3fd2cec92e Mon Sep 17 00:00:00 2001 From: Jason Levine Date: Fri, 26 Jun 2026 14:36:34 -0400 Subject: [PATCH] fix(select): allow relative URLs for advanced select apiUrl --- src/plugins/select/core.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/select/core.ts b/src/plugins/select/core.ts index 87a10ee..1b5a772 100644 --- a/src/plugins/select/core.ts +++ b/src/plugins/select/core.ts @@ -1610,7 +1610,13 @@ class HSSelect extends HSBasePlugin implements ISelect { private async apiRequest(val = '', signal?: AbortSignal): Promise { try { - const url = new URL(this.apiUrl); + let url; + try { + url = new URL(this.apiUrl, window.location.origin); + } catch { + console.error('Invalid API URL:', this.apiUrl); + return null; + } const queryParams = new URLSearchParams(this.apiQuery ?? ''); const options = this.apiOptions ?? {}; const tempOptions = { ...(options as any) } as RequestInit;