diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index 27db4718b..618fb33d1 100644 Binary files a/netbox/project-static/dist/netbox.js and b/netbox/project-static/dist/netbox.js differ diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map index d54ded87b..95dd32d48 100644 Binary files a/netbox/project-static/dist/netbox.js.map and b/netbox/project-static/dist/netbox.js.map differ diff --git a/netbox/project-static/src/select/classes/dynamicTomSelect.ts b/netbox/project-static/src/select/classes/dynamicTomSelect.ts index 758462b60..72c9fe518 100644 --- a/netbox/project-static/src/select/classes/dynamicTomSelect.ts +++ b/netbox/project-static/src/select/classes/dynamicTomSelect.ts @@ -74,20 +74,25 @@ export class DynamicTomSelect extends TomSelect { load(value: string) { const self = this; - const url = self.getRequestUrl(value); // Automatically clear any cached options. (Only options included // in the API response should be present.) self.clearOptions(); - addClasses(self.wrapper, self.settings.loadingClass); - self.loading++; - // Populate the null option (if any) if not searching if (self.nullOption && !value) { self.addOption(self.nullOption); } + // Get the API request URL. If none is provided, abort as no request can be made. + const url = self.getRequestUrl(value); + if (!url) { + return; + } + + addClasses(self.wrapper, self.settings.loadingClass); + self.loading++; + // Make the API request fetch(url) .then(response => response.json()) @@ -129,6 +134,9 @@ export class DynamicTomSelect extends TomSelect { for (const result of this.api_url.matchAll(new RegExp(`({{${key}}})`, 'g'))) { if (value) { url = replaceAll(url, result[1], value.toString()); + } else { + // No value is available to replace the token; abort. + return ''; } } }