Skip to content

Conversation

@taranvohra
Copy link
Member

@taranvohra taranvohra commented Jan 6, 2026

The share key is preserved only within spaces of the site while resolving content refs. Otherwise it's reset

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: a4a0864

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linear
Copy link

linear bot commented Jan 6, 2026

@argos-ci
Copy link

argos-ci bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) ✅ No changes detected - Jan 7, 2026, 5:02 AM
v2-cloudflare (Inspect) 👍 Changes approved 18 changed Jan 7, 2026, 5:06 AM
v2-vercel (Inspect) 👍 Changes approved 20 changed Jan 7, 2026, 5:06 AM

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

This PR fixes an issue where content references to spaces outside of a site were incorrectly resolving with share link tokens. The fix ensures that share keys are only preserved for links within the same site, not for cross-site references.

  • Modified the resolveContentRefInSpace function to conditionally pass the share key only when the target space exists within the current site
  • Added E2E tests to verify correct behavior for both same-site and cross-site links with share tokens
  • Refactored the foundSiteSpace lookup to avoid duplication

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/gitbook/src/lib/references.tsx Fixed logic to conditionally pass shareKey based on whether the target space is in the current site, and refactored duplicate code
packages/gitbook/e2e/internal.spec.ts Added E2E tests to verify share link tokens are preserved for same-site navigation but not for cross-site links
.changeset/silver-ideas-relax.md Added changeset describing the bug fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@taranvohra taranvohra merged commit ebf3b2b into main Jan 7, 2026
16 checks passed
@taranvohra taranvohra deleted the taran/rnd-9180-incorrect-url-linking-on-sites-with-share-link branch January 7, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants