-
Notifications
You must be signed in to change notification settings - Fork 434
π (lld) translated error anchors render #11536
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
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
553a595
to
9488816
Compare
9488816
to
0f79f32
Compare
0f79f32
to
186d751
Compare
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
Fixes the rendering of translated error messages that contain HTML anchor tags from the Ledger Status API. Previously, anchor tags were not properly rendered as clickable links, and debug console logs were left in production code.
- Added a new utility function to parse and render HTML anchor tags as React Link components
- Implemented security validation to only allow clicks on trusted Ledger domains
- Removed debug console.log statements from production code
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
TranslatedError.tsx | Added conditional rendering for error messages containing anchor tags |
ErrorWithAnchor.tsx | New utility for parsing HTML anchors and rendering secure clickable links |
ErrorWithAnchor.test.tsx | Comprehensive test coverage for anchor parsing and security validation |
ServiceStatusPanel.tsx | Updated to use new anchor rendering utility and removed debug logs |
ledgerStatus.ts | Added mock data for testing status API responses with anchor tags |
browser.ts | Added MSW handler for status API mocking |
proud-bugs-care.md | Changeset documentation for the fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
apps/ledger-live-desktop/src/renderer/components/TranslatedError/ErrorWithAnchor.tsx
Outdated
Show resolved
Hide resolved
apps/ledger-live-desktop/src/renderer/components/TranslatedError/ErrorWithAnchor.tsx
Outdated
Show resolved
Hide resolved
apps/ledger-live-desktop/src/renderer/components/TranslatedError/ErrorWithAnchor.tsx
Outdated
Show resolved
Hide resolved
186d751
to
01158d8
Compare
01158d8
to
779a80a
Compare
β Checklist
npx changeset
was attached.π Description
This PR introduces a fix to be able to render link received from status.ledger.com/api/v2. The issue is that they send the anchor tag directly in the body of the incident. We need to handle this.
For security reasons, we need to whitelist the domain before making the link clickable. If it's not clickable, we will just display text and no link.
Also, I leverage MSW to mock incidents from the status page so it's easier to debug
Donjon has checked this method, and the risk is sufficiently mitigated β
β Context
π§ Checklist for the PR Reviewers