Skip to content

Conversation

@barjin
Copy link
Contributor

@barjin barjin commented Oct 22, 2025

Parses the current location as a URL before appending the .md suffix to route to the correct md URL.

E.g. Hubspot adds those tracking query parameters, old code would add the .md suffix to the end of the query params.

image

@barjin barjin requested review from Copilot and webrdaniel October 22, 2025 09:13
@barjin barjin self-assigned this Oct 22, 2025
@barjin barjin added the adhoc Ad-hoc unplanned task added during the sprint. label Oct 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes the "Copy for LLMs" button to correctly handle URLs with query parameters by parsing the URL and appending .md only to the pathname, rather than to the entire URL string which would incorrectly place .md after query parameters.

  • Updated getMarkdownUrl function to use URL parsing
  • Ensures .md suffix is added to pathname only, preserving query parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions github-actions bot added this to the 126th sprint - Tooling team milestone Oct 22, 2025
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 22, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment @cursor review or bugbot run to trigger another review on this PR

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

Copy link
Contributor

@webrdaniel webrdaniel left a comment

Choose a reason for hiding this comment

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

Thanks ✅

@barjin barjin merged commit 925ee93 into master Oct 22, 2025
10 checks passed
@barjin barjin deleted the fix/llm-button-with-query-params branch October 22, 2025 09:16
@apify-service-account
Copy link

Preview for this PR was built for commit 6a773a3 and is ready at https://pr-2036.preview.docs.apify.com!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants