-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix an issue where content refs to spaces outside of site was resolving with share links #3889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix an issue where content refs to spaces outside of site was resolving with share links #3889
Conversation
🦋 Changeset detectedLatest commit: a4a0864 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
…s-with-share-link
There was a problem hiding this 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
resolveContentRefInSpacefunction 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
foundSiteSpacelookup 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.
The share key is preserved only within spaces of the site while resolving content refs. Otherwise it's reset