-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
fix(sidebar): use RegExp for outgoing link detection #7844
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
Conversation
Signed-off-by: Aviv Keller <me@aviv.sh>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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
Update the sidebar link logic to detect outgoing links based on a full protocol pattern rather than a simple prefix check.
- Replace
link.startsWith('http')with a regex test forhttp:orhttps:protocols. - Ensure only actual external URLs render the external-link icon.
Comments suppressed due to low confidence (1)
packages/ui-components/Containers/Sidebar/SidebarItem/index.tsx:39
- Add unit tests for this new outgoing link detection regex to verify both matching cases (e.g.,
http://,https://) and non-matching paths (e.g.,/http-docs/).
{/^https?:/.test(link) && <ArrowUpRightIcon className={styles.icon} />}
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #7844 +/- ##
==========================================
+ Coverage 75.44% 75.47% +0.02%
==========================================
Files 101 101
Lines 8305 8305
Branches 218 218
==========================================
+ Hits 6266 6268 +2
+ Misses 2037 2035 -2
Partials 2 2 ☔ View full report in Codecov by Sentry. |
ovflowd
left a comment
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.
LGTM
|
I believe this fix can be fast-tracked. Simple enough. |
|
Lighthouse Results
|
For
api-docs-tooling,HTTPdocumentations are being mis-interpreted as outgoing links. We should instead check the full protocol.