Skip to content

Commit e42c030

Browse files
committed
fix(web): resolve file-chip browser opens through the workspace index
PDF and HTML chip clicks now use the same index lookup as panel, reveal, and editor so a slashed path opens the real file. Model: grok-4.6 · Harness: grok
1 parent ed9cfa5 commit e42c030

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎apps/web/src/components/ChatMarkdown.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,18 @@ function ChatMarkdown({
19041904
},
19051905
[cwd, findWorkspaceBasenameMatch, openInPreferredEditor],
19061906
);
1907+
const openMarkdownFileInBrowser = useCallback(
1908+
async (fileLinkMeta: MarkdownFileLinkMeta) => {
1909+
const workspaceRelativePath = fileLinkMeta.workspaceRelativePath;
1910+
const match = workspaceRelativePath
1911+
? await findWorkspaceBasenameMatch(workspaceRelativePath)
1912+
: null;
1913+
return openMarkdownFileInPreview(
1914+
match && cwd ? resolvePathLinkTarget(match, cwd) : fileLinkMeta.filePath,
1915+
);
1916+
},
1917+
[cwd, findWorkspaceBasenameMatch, openMarkdownFileInPreview],
1918+
);
19071919
/* eslint-disable react/no-unstable-nested-components -- ReactMarkdown requires component
19081920
* renderers that close over this message's metadata. useMemo keeps them stable until that
19091921
* metadata changes. */
@@ -1951,7 +1963,7 @@ function ChatMarkdown({
19511963
threadRef &&
19521964
isPreviewSupportedInRuntime() &&
19531965
isBrowserPreviewFile(fileLinkMeta.filePath)
1954-
? () => openMarkdownFileInPreview(fileLinkMeta.filePath)
1966+
? () => openMarkdownFileInBrowser(fileLinkMeta)
19551967
: undefined
19561968
}
19571969
className={className}
@@ -2237,7 +2249,7 @@ function ChatMarkdown({
22372249
openMarkdownFileInEditor,
22382250
openChangeRequestLink,
22392251
openExternalLinkInPreview,
2240-
openMarkdownFileInPreview,
2252+
openMarkdownFileInBrowser,
22412253
preferredEditorMenuLabel,
22422254
resolveThreadPullRequest,
22432255
resolvedTheme,

0 commit comments

Comments
 (0)