Check for parentUrl when deciding whether a SPA specific url parameter should be ignored (#2881)

This commit is contained in:
Hugh Nimmo-Smith
2024-12-11 09:26:55 +00:00
committed by GitHub
parent 45564fd629
commit 8558f0349f
2 changed files with 8 additions and 3 deletions

View File

@@ -97,7 +97,11 @@ describe("UrlParams", () => {
});
it("respected in widget mode", () => {
expect(getUrlParams("?preload=true&widgetId=12345").preload).toBe(true);
expect(
getUrlParams(
"?preload=true&widgetId=12345&parentUrl=https%3A%2F%2Flocalhost%2Ffoo",
).preload,
).toBe(true);
});
});

View File

@@ -212,11 +212,12 @@ export const getUrlParams = (
const fontScale = parseFloat(parser.getParam("fontScale") ?? "");
const widgetId = parser.getParam("widgetId");
const isWidget = !!widgetId;
const parentUrl = parser.getParam("parentUrl");
const isWidget = !!widgetId && !!parentUrl;
return {
widgetId,
parentUrl: parser.getParam("parentUrl"),
parentUrl,
// NB. we don't validate roomId here as we do in getRoomIdentifierFromUrl:
// what would we do if it were invalid? If the widget API says that's what