-
Notifications
You must be signed in to change notification settings - Fork 5k
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: Issue 26751 QR barcode scanner #27002
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@@ -30,8 +30,8 @@ const parseContent = (content) => { | |||
// Ethereum address links - fox ex. ethereum:0x.....1111 | |||
if (content.split('ethereum:').length > 1) { | |||
type = 'address'; | |||
values = { address: content.split('ethereum:')[1] }; | |||
|
|||
// uses regex capture groups to match and extract address while ignoring everythign else |
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.
Nit: everythign
-> everything
values = { address: content.split('ethereum:')[1] }; | ||
|
||
// uses regex capture groups to match and extract address while ignoring everythign else | ||
values = { address: content.match(/.*:(0x[0-9a-fA-F]{40})(?:@.*)?/)[1] } |
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.
I hate pointing this out but should we have this regex in a function so we can add a test? Also, is there a product consideration here? i.e. if the string ends in 0x89
, and the user is on Mainnet, should something happen?
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.
+1 on test. though it is in parseContent
, but I can make a test for this.
. if the string ends in 0x89, and the user is on Mainnet, should something happen?
perhaps, though I feel that's outside the scope of the bug.
Builds ready [7cc5c26]
Page Load Metrics (1757 ± 110 ms)
Bundle size diffs
|
7cc5c26
to
3e0d03f
Compare
Builds ready [3e0d03f]
Page Load Metrics (1622 ± 78 ms)
Bundle size diffs
|
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.
Works as expected! Thank you for adding tests!
Builds ready [4f7f808]
Page Load Metrics (1805 ± 94 ms)
Bundle size diffs
|
Quality Gate passedIssues Measures |
Builds ready [d73dca0]
Page Load Metrics (1959 ± 140 ms)
Bundle size diffs
|
Missing release label release-12.5.0 on PR. Adding release label release-12.5.0 on PR and removing other release labels(release-12.6.0), as PR was added to branch 12.5.0 when release was cut. |
Description
QR scanning broke some time ago. This PR fixes scanning QR codes when provided a QR code from either mobile or from extension by extracting just the address.
Instead of using various splits and conditionals, I use regex capture groups to extract the address.
Related issues
Fixes:
#26751
#21766
Manual testing steps
to
fieldScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist