Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apify-docs-theme/src/theme/LLMButtons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ const DROPDOWN_OPTIONS = [
];

const getPrompt = (currentUrl) => `Read from ${currentUrl} so I can ask questions about it.`;
const getMarkdownUrl = (currentUrl) => `${currentUrl}.md`;
const getMarkdownUrl = (currentUrl) => {
const url = new URL(currentUrl);
url.pathname = `${url.pathname.replace(/\/$/, '')}.md`;
return url.toString();
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Root Path URL Malformation

The getMarkdownUrl function produces malformed URLs when the currentUrl is a root path (e.g., "https://example.com/"). Removing the trailing slash from a root pathname "/" results in an empty string, leading to an invalid URL like "https://example.com/.md".

Fix in Cursor Fix in Web


const onOpenInChatGPTClick = () => {
if (window.analytics) {
Expand Down