Merge branch 'krille/checkHomeserver' into 'main'

fix: Trailing slash homeserver from wellknown

See merge request famedly/famedlysdk!627
This commit is contained in:
Marcel 2021-01-27 08:49:54 +00:00
commit 7214662770
1 changed files with 7 additions and 1 deletions

View File

@ -313,7 +313,13 @@ class Client extends MatrixApi {
if (checkWellKnown) {
try {
final wellKnown = await requestWellKnownInformations();
homeserver = Uri.parse(wellKnown.mHomeserver.baseUrl);
homeserverUrl = wellKnown.mHomeserver.baseUrl.trim();
// strip a trailing slash
if (homeserverUrl.endsWith('/')) {
homeserverUrl =
homeserverUrl.substring(0, homeserverUrl.length - 1);
}
homeserver = Uri.parse(homeserverUrl);
} catch (e) {
Logs().v('Found no well known information', e);
}