From 75e4d164626c9241bae6f9504b06a7225dc16336 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 16 Jul 2021 13:10:58 +0100 Subject: [PATCH] use js-sdk decodeParams utility --- src/vector/url_utils.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/vector/url_utils.ts b/src/vector/url_utils.ts index d5efcdaaba..98c6e39366 100644 --- a/src/vector/url_utils.ts +++ b/src/vector/url_utils.ts @@ -14,11 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {urlSearchParamsToObject} from "matrix-react-sdk/src/utils/UrlUtils"; - -interface IParamsObject { - [key: string]: string; -} +import { QueryDict, decodeParams } from "matrix-js-sdk/src/utils"; // We want to support some name / value pairs in the fragment // so we're re-using query string like format @@ -36,15 +32,15 @@ export function parseQsFromFragment(location: Location) { const result = { location: decodeURIComponent(hashparts[0]), - params: {}, + params: {}, }; if (hashparts.length > 1) { - result.params = urlSearchParamsToObject(new URLSearchParams(hashparts[1])); + result.params = decodeParams(hashparts[1]); } return result; } -export function parseQs(location: Location) { - return urlSearchParamsToObject(new URLSearchParams(location.search)); +export function parseQs(location: Location): QueryDict { + return decodeParams(location.search.substring(1)); }