fix: handle trailing slashes in block explorer URLs - #8592
Conversation
041170d to
ecce617
Compare
rekmarks
left a comment
There was a problem hiding this comment.
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! |
What
ui/app/helpers/utils/transactions.util.jsandui/lib/account-link.jsto 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.