From 9c4b2547b4b79456d77a15541dc5ff56fcccb24c Mon Sep 17 00:00:00 2001 From: Nolann Biron Date: Sat, 4 Oct 2025 18:15:33 +0200 Subject: [PATCH] Fix markdownPageURL for PageActions --- .changeset/eight-eels-sort.md | 5 +++++ packages/gitbook/src/components/PageActions/PageActions.tsx | 5 ++++- packages/gitbook/src/components/PageBody/PageHeader.tsx | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/eight-eels-sort.md diff --git a/.changeset/eight-eels-sort.md b/.changeset/eight-eels-sort.md new file mode 100644 index 0000000000..ac16a4d95e --- /dev/null +++ b/.changeset/eight-eels-sort.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix markdownPageURL for PageActions diff --git a/packages/gitbook/src/components/PageActions/PageActions.tsx b/packages/gitbook/src/components/PageActions/PageActions.tsx index 09c7819df5..55b9b2c3db 100644 --- a/packages/gitbook/src/components/PageActions/PageActions.tsx +++ b/packages/gitbook/src/components/PageActions/PageActions.tsx @@ -171,6 +171,9 @@ export function ActionOpenInLLM(props: { const providerLabel = provider === 'chatgpt' ? 'ChatGPT' : 'Claude'; + // Remove the .md extension from the URL to avoid sending a bad request to the LLM. + const urlWithoutExtension = url.replace(/\.md$/, ''); + return ( ); } diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx index fd838d9e0f..e6d1c1c44f 100644 --- a/packages/gitbook/src/components/PageBody/PageHeader.tsx +++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx @@ -40,7 +40,7 @@ export async function PageHeader(props: { // Show page actions if *any* of the actions are enabled