diff --git a/spec/unit/autodiscovery.spec.js b/spec/unit/autodiscovery.spec.js index f6cb486a1..6d4e5a3e9 100644 --- a/spec/unit/autodiscovery.spec.js +++ b/spec/unit/autodiscovery.spec.js @@ -275,7 +275,7 @@ describe("AutoDiscovery", function() { "m.homeserver": { state: "FAIL_ERROR", error: AutoDiscovery.ERROR_INVALID_HOMESERVER, - base_url: null, + base_url: "https://example.org", }, "m.identity_server": { state: "PROMPT", @@ -304,7 +304,7 @@ describe("AutoDiscovery", function() { "m.homeserver": { state: "FAIL_ERROR", error: AutoDiscovery.ERROR_INVALID_HOMESERVER, - base_url: null, + base_url: "https://example.org", }, "m.identity_server": { state: "PROMPT", @@ -335,7 +335,7 @@ describe("AutoDiscovery", function() { "m.homeserver": { state: "FAIL_ERROR", error: AutoDiscovery.ERROR_INVALID_HOMESERVER, - base_url: null, + base_url: "https://example.org", }, "m.identity_server": { state: "PROMPT", @@ -528,7 +528,7 @@ describe("AutoDiscovery", function() { "m.identity_server": { state: "FAIL_ERROR", error: AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER, - base_url: null, + base_url: "https://identity.example.org", }, }; @@ -569,7 +569,7 @@ describe("AutoDiscovery", function() { "m.identity_server": { state: "FAIL_ERROR", error: AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER, - base_url: null, + base_url: "https://identity.example.org", }, }; diff --git a/src/autodiscovery.js b/src/autodiscovery.js index 10f714d24..900c01663 100644 --- a/src/autodiscovery.js +++ b/src/autodiscovery.js @@ -256,6 +256,11 @@ export class AutoDiscovery { if (!hsVersions || !hsVersions.raw["versions"]) { logger.error("Invalid /versions response"); clientConfig["m.homeserver"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER; + + // Supply the base_url to the caller because they may be ignoring liveliness + // errors, like this one. + clientConfig["m.homeserver"].base_url = hsUrl; + return Promise.resolve(clientConfig); } @@ -311,6 +316,11 @@ export class AutoDiscovery { logger.error("Invalid /api/v1 response"); failingClientConfig["m.identity_server"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER; + + // Supply the base_url to the caller because they may be ignoring + // liveliness errors, like this one. + failingClientConfig["m.identity_server"].base_url = isUrl; + return Promise.resolve(failingClientConfig); } }