From 386248a0468b90f9e0f46b17a40fa388af7f8fdb Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 28 Jun 2020 11:54:00 +0000 Subject: [PATCH] Fix wellknown with trailing slash --- lib/matrix_api/matrix_api.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matrix_api/matrix_api.dart b/lib/matrix_api/matrix_api.dart index 8eac0e4..2109bef 100644 --- a/lib/matrix_api/matrix_api.dart +++ b/lib/matrix_api/matrix_api.dart @@ -214,8 +214,11 @@ class MatrixApi { /// Gets discovery information about the domain. The file may include additional keys. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-well-known-matrix-client Future requestWellKnownInformations() async { - final response = await httpClient - .get('${homeserver.toString()}/.well-known/matrix/client'); + var baseUrl = homeserver.toString(); + if (baseUrl.endsWith('/')) { + baseUrl = baseUrl.substring(0, baseUrl.length - 1); + } + final response = await httpClient.get('$baseUrl/.well-known/matrix/client'); final rawJson = json.decode(response.body); return WellKnownInformations.fromJson(rawJson); }