-
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: handle trailing slashes in block explorer URLs #8592
fix: handle trailing slashes in block explorer URLs #8592
Conversation
041170d
to
ecce617
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.
Neat work, thanks!
Please resolve the lint failures and push again. yarn lint:fix
or yarn lint:changed:fix
(quicker, if you do a soft reset), should do the trick.
ecce617
to
d19b46b
Compare
@rekmarks done, looks like the various CI lint tasks have all passed now. Earlier on https://circleci.com/gh/MetaMask/metamask-extension/164993
|
What - modify `ui/app/helpers/utils/transactions.util.js` and `ui/lib/account-link.js` to strip trailing slashes if they are present. - added relevant tests not just for the new scenario, but also the general scenarios for these functions, as there previously was no test coverage for these two functions. Why - Current behaviour, when user enters a block explorer URL when configuring a custom RPC, and that block explorer URL contains a trailing `/`. - e.g. `https://block.explorer/` - this results in a double-slash (`//`) in the transaction and account URLs generated by MetaMask. - e.g. `https://block.explorer/tx/0xabcd...`, `https://block.explorer/account/0xabcd...` - This needs to be handled using a router redirect on the server of the block explorer, and this changes would avoid that requirement.
d19b46b
to
96929d9
Compare
Yeah, our e2e tests aren’t especially reliable, currently 🙃 |
@whymarrh yeah, well one more failed test-e2e-Firefox, same error, but I manually triggered the build by doing another forced push. All checks are passing now! |
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!
@bguiz, this is a lovely example of an external PR. I really appreciate the care you put into it.
What
ui/app/helpers/utils/transactions.util.js
andui/lib/account-link.js
to strip trailing slashesif they are present.
but also the general scenarios for these functions,
as there previously was no test coverage for these
two functions.
Why
when configuring a custom RPC, and that block explorer URL
contains a trailing
/
.https://block.explorer/
//
) in the transactionand account URLs generated by MetaMask.
https://block.explorer/tx/0xabcd...
,https://block.explorer/account/0xabcd...
on the server of the block explorer,
and this changes would avoid that requirement.