Browse Source

fix(iot-hub): normalize the Device connectivity host before the loopback check

isLoopbackHost takes a bare host since 66ed132, but addTransportFields
passed the server value as is. The Device connectivity host isn't
validated, so it can be saved as localhost:1883; DeviceConnectivityUtil.getHost
returns that unchanged. It then wasn't seen as loopback, the fields became
read-only, and the sketch / docker-compose got localhost with no way to
correct it.

addTransportFields now reduces the server host with toBareHost once, and
uses the bare host for the loopback check, the default value and the hints.
pull/16376/head
dpinkevych 1 month ago
parent
commit
917258d941
  1. 6
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

6
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

@ -827,10 +827,12 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
this.hostFieldProtocol = null;
const transport = HOST_FIELD_TRANSPORTS.get(this.selectedInstallMethod);
const protocol = transport?.protocol;
const resolvedHost = protocol ? this.transportVars[`${protocol}.host`] : undefined;
if (resolvedHost === undefined) {
const serverHost = protocol ? this.transportVars[`${protocol}.host`] : undefined;
if (serverHost === undefined) {
return;
}
// The Device connectivity host isn't validated, so it can come with a port or a scheme (localhost:1883)
const resolvedHost = toBareHost(serverHost);
const steps = this.wizardSteps.slice(fromIndex);
const firstUse = steps.findIndex(ws => this.usesVariable(ws, `${protocol}.host`));
if (firstUse < 0) {

Loading…
Cancel
Save