From 01f93e09706ab2774570c54b807c8a8fbf737a78 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 19 Aug 2017 10:38:17 +0100 Subject: [PATCH] consume trailing slash when creating Matrix Client in HS and IS urls Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/client.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client.js b/src/client.js index 5f7a542de..9dc96023e 100644 --- a/src/client.js +++ b/src/client.js @@ -113,6 +113,16 @@ try { * crypto store implementation. */ function MatrixClient(opts) { + // Allow trailing slash in HS url + if (opts.baseUrl && opts.baseUrl.endsWith("/")) { + opts.baseUrl = opts.baseUrl.substr(0, opts.baseUrl.length - 1); + } + + // Allow trailing slash in IS url + if (opts.idBaseUrl && opts.idBaseUrl.endsWith("/")) { + opts.idBaseUrl = opts.idBaseUrl.substr(0, opts.idBaseUrl.length - 1); + } + MatrixBaseApis.call(this, opts); this.store = opts.store || new StubStore();