Page MenuHomePhabricator

[Cashtab] New token URL validation
ClosedPublic

Authored by kieran709 on Dec 8 2021, 17:53.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC4b75fdde4914: [Cashtab] New token URL validation
Summary

Altered the isValidTokenDocumentUrl function to include a simple regex url valiation pattern, updated validation.test.js to include new unit tests, and updated warning message to reflect new conditions for token URLs.

Test Plan

cd web/cashtab
npm start
navigate to the createToken form
begin inputting url
ensure that if the conditions aren't met, an error message will be displayed
ensure that when the conditions are met, the error message disappears
ensure error message is adequate in CreateTokenForm.js

in a new terminal:
npm test
ensure all tests pass

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

1st level review is green. Need to give Tobias a nudge to update the Document URI handling logic on be.cash's side so it's not recognizing 'www.url.com' URIs as a transaction ID.

Linking D10667 here as a reminder to port over this regex validation for NFT URLs.

bytesofman added inline comments.
web/cashtab/src/components/Tokens/CreateTokenForm.js
600 ↗(On Diff #31330)

Let's tighten this up to make sure it fits on one line. Change to

Must be a valid URL. Cannot exceed 68 characters.
This revision now requires changes to proceed.Dec 13 2021, 19:32

Edited error text to match review feedback.

This revision is now accepted and ready to land.Dec 14 2021, 18:52
This revision was automatically updated to reflect the committed changes.