Uniswap / token-lists

📚 The Token Lists specification
https://tokenlists.org
MIT License
1.36k stars 930 forks source link

Shouldn't this be a `not` ? This pattern allows for token names starting with whitespace, `\`, etc... #519

Open greenlucid opened 9 months ago

greenlucid commented 9 months ago

https://github.com/Uniswap/token-lists/blob/8e9f553b655aaa4f3aebeed8b8b1108f98a696e5/src/tokenlist.schema.json#L236

Can someone explain to me the logic behind this regex?

^[ \\S+]+$

Shouldn't it be the opposite? Why does it allow tokens starting with a whitespace?

In this commit it was changed from the pattern, before kept under name.pattern, now in name.anyOf[1].pattern. I also got similar confusion with symbol.

https://github.com/Uniswap/token-lists/commit/61c44116979325a847de1c9848b3687155f0ce0d