mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 01:35:49 +03:00
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 throw
This commit is contained in:
parent
3342aa5ff8
commit
f712b809e2
1 changed files with 6 additions and 2 deletions
|
@ -359,10 +359,14 @@ export class SlidingSyncManager {
|
|||
let proxyUrl: string | undefined;
|
||||
|
||||
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;
|
||||
} 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) {
|
||||
|
|
Loading…
Reference in a new issue