fix: Fetch well-known from domain from userId, not from homeserver domain

This commit is contained in:
krille-chan 2025-05-08 18:55:05 +02:00
parent d398ade831
commit fc79d7142b
No known key found for this signature in database
1 changed files with 7 additions and 1 deletions

View File

@ -585,7 +585,13 @@ class Client extends MatrixApi {
/// The result of this call is stored in [wellKnown] for later use at runtime. /// The result of this call is stored in [wellKnown] for later use at runtime.
@override @override
Future<DiscoveryInformation> getWellknown() async { Future<DiscoveryInformation> getWellknown() async {
final wellKnown = await super.getWellknown(); final wellKnownResponse = await httpClient.get(
Uri.https(userID!.domain!, '/.well-known/matrix/client'),
);
final wellKnown = DiscoveryInformation.fromJson(
jsonDecode(utf8.decode(wellKnownResponse.bodyBytes))
as Map<String, Object?>,
);
// do not reset the well known here, so super call // do not reset the well known here, so super call
super.homeserver = wellKnown.mHomeserver.baseUrl.stripTrailingSlash(); super.homeserver = wellKnown.mHomeserver.baseUrl.stripTrailingSlash();