From 2c5b132483102283478ca4da6f10365d27495406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Sat, 18 Jun 2022 21:23:40 +0200 Subject: [PATCH] fix(util) fix parsing strings in parseURLParams After https://github.com/jitsi/jitsi-meet/pull/11607 we might call it with a string. Be nice and accept that in addition to URL objects. --- react/features/base/util/parseURLParams.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/react/features/base/util/parseURLParams.js b/react/features/base/util/parseURLParams.js index 56f1fb4ac..11494e405 100644 --- a/react/features/base/util/parseURLParams.js +++ b/react/features/base/util/parseURLParams.js @@ -23,9 +23,13 @@ const blacklist = [ '__proto__', 'constructor', 'prototype' ]; * @returns {Object} */ export function parseURLParams( - url: URL, + url: URL | string, dontParse: boolean = false, source: string = 'hash'): Object { + if (typeof url === 'string') { + // eslint-disable-next-line no-param-reassign + url = new URL(url); + } const paramStr = source === 'search' ? url.search : url.hash; const params = {}; const paramParts = (paramStr && paramStr.substr(1).split('&')) || [];