Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Closes GIT-7894 302 redirect should not affect /properties (#62664)

Sébastiend2e66d008123
diff --git a/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js b/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js
index a4c29d1d1f1..f0535054815 100644
--- a/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js
+++ b/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js
@@ -385,4 +385,18 @@ describe("scenarios [EE] > public > dashboard", () => {
"rgba(0, 0, 0, 0)",
);
});
+
+ it("should handle /api/session/properties incorrect response (metabase#62501)", () => {
+ cy.intercept("/api/session/properties", {
+ statusCode: 200,
+ headers: {},
+ body: "<html><body><h1>Those aren't the droids you're looking for</h1></body></html>",
+ });
+
+ cy.get("@dashboardId").then(H.visitPublicDashboard);
+
+ cy.findByTestId("embed-frame").within(() => {
+ cy.findByText("Test Dashboard").should("exist");
+ });
+ });
});
diff --git a/frontend/src/metabase/api/session.ts b/frontend/src/metabase/api/session.ts
index 99086a21d6a..a7b595a64ec 100644
--- a/frontend/src/metabase/api/session.ts
+++ b/frontend/src/metabase/api/session.ts
@@ -34,7 +34,8 @@ export const sessionApi = Api.injectEndpoints({
providesTags: ["session-properties"],
onQueryStarted: async (_, { queryFulfilled, dispatch }) => {
const response = await queryFulfilled;
- if (response.data) {
+ // In some cases, the response is an HTML string because of a redirect (metabase#62501)
+ if (response.data && typeof response.data === "object") {
dispatch(loadSettings(response.data));
// compatibility layer for legacy settings on the window object
MetabaseSettings.setAll(response.data);