From 975ff9c83d39e4f8e77acc7471d0d4fa755d35a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 6 Mar 2019 13:12:54 +0100 Subject: [PATCH] rn: support passing serverURL and room to URL object That's what the SDK passes now, if the room URL is not absolute. --- react/features/base/util/uri.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/react/features/base/util/uri.js b/react/features/base/util/uri.js index de9e9c4ea..dc9afd9fa 100644 --- a/react/features/base/util/uri.js +++ b/react/features/base/util/uri.js @@ -377,7 +377,19 @@ export function toURLString(obj: ?(Object | string)): ?string { * {@code Object}. */ export function urlObjectToString(o: Object): ?string { - const url = parseStandardURIString(_fixURIStringScheme(o.url || '')); + // First normalize the given url. It come as o.url or split into o.serverURL + // and o.room. + let tmp; + + if (o.serverURL && o.room) { + tmp = new URL(o.room, o.serverURL).toString(); + } else if (o.room) { + tmp = o.room; + } else { + tmp = o.url || ''; + } + + const url = parseStandardURIString(_fixURIStringScheme(tmp)); // protocol if (!url.protocol) {