rn: support passing serverURL and room to URL object
That's what the SDK passes now, if the room URL is not absolute.
This commit is contained in:
parent
5b3e8a9b5e
commit
975ff9c83d
|
@ -377,7 +377,19 @@ export function toURLString(obj: ?(Object | string)): ?string {
|
||||||
* {@code Object}.
|
* {@code Object}.
|
||||||
*/
|
*/
|
||||||
export function urlObjectToString(o: Object): ?string {
|
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
|
// protocol
|
||||||
if (!url.protocol) {
|
if (!url.protocol) {
|
||||||
|
|
Loading…
Reference in New Issue