mirror of https://github.com/vector-im/riot-web
Remove code smell assertion identified by Sonar (#12547)
* This assertion is unnecessary since the receiver accepts the original type of the expression * Implement `client.getDomain()` null check * Update comment since `AutoDiscovery.findClientConfig` may still throwpull/28217/head
parent
3342aa5ff8
commit
f712b809e2
|
@ -359,10 +359,14 @@ export class SlidingSyncManager {
|
||||||
let proxyUrl: string | undefined;
|
let proxyUrl: string | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const clientWellKnown = await AutoDiscovery.findClientConfig(client.getDomain()!);
|
const clientDomain = await client.getDomain();
|
||||||
|
if (clientDomain === null) {
|
||||||
|
throw new RangeError("Homeserver domain is null");
|
||||||
|
}
|
||||||
|
const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain);
|
||||||
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
|
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// client.getDomain() is invalid, `AutoDiscovery.findClientConfig` has thrown
|
// Either client.getDomain() is null so we've shorted out, or is invalid so `AutoDiscovery.findClientConfig` has thrown
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proxyUrl != undefined) {
|
if (proxyUrl != undefined) {
|
||||||
|
|
Loading…
Reference in New Issue