Skip to content

Commit 7338ef6

Browse files
committed
Enable origin handling only in case of embedded
1 parent c55ae69 commit 7338ef6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web/src/components/common/Markdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Image, Box, Collapse, Tag, TagLabel, TagLeftIcon, Button } from "@chakr
77
import { useSelector } from 'react-redux'
88
import { RootState } from '../../state/store'
99
import { renderString } from '../../helpers/templatize'
10-
import { getOrigin } from '../../helpers/origin'
10+
import { getOrigin, getParsedIframeInfo } from '../../helpers/origin'
1111
import { getApp } from '../../helpers/app'
1212
import { processSQLWithCtesOrModels } from '../../helpers/catalogAsModels'
1313
import { getAllTemplateTagsInQuery, replaceLLMFriendlyIdentifiersInSqlWithModels } from 'apps'
@@ -170,6 +170,7 @@ function ImageComponent(props: any) {
170170
function generateMetabaseQuestionURL(sql: string, databaseId: number | null = null, embedConfigs: EmbedConfigs = {}) {
171171
// Get Metabase origin from embed_configs if available, otherwise use iframe info
172172
const templateTags = getAllTemplateTagsInQuery(sql);
173+
const isEmbedded = getParsedIframeInfo().isEmbedded as unknown === 'true'
173174

174175
// Get all template tags in the query (we don't have access to snippets here, so pass undefined)
175176
const cardData = {
@@ -189,7 +190,7 @@ function generateMetabaseQuestionURL(sql: string, databaseId: number | null = nu
189190

190191
const hash = btoa(JSON.stringify(cardData));
191192
const origin = embedConfigs.embed_host;
192-
if (!origin) {
193+
if (!origin || !isEmbedded) {
193194
return `${getOrigin()}/question#${hash}`;
194195
}
195196
return `${origin}/question?hash=${hash}`;

0 commit comments

Comments
 (0)