-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 NPM packages name validation (#26595) #26606
Conversation
- Added new tests to cover corner cases - Replace existing regex with new one Closes go-gitea#26551 --- As @silverwind suggested, I started from [validate-npm-package-name](https://github.com/npm/validate-npm-package-name), but found this solution too complicated. Then I tried to fix existing regex myself, but thought, that exclude all restricted symbols is harder, than set only allowed symbols. Then I search a bit more and found [package-name-regex](https://github.com/dword-design/package-name-regex) and regex from it works for all new test cases. Let me know, if more information or help with this PR is needed.
Hmm… |
Why does it a breaking change? |
Yes, but packages that could previously be uploaded can no longer be uploaded. |
Might want to keep this for 1.21 when it's restricting the packages. |
Backport #26595 by @TimberBro
Closes NPM Package Registry returns HTTP400 for packages with single-character names #26551
As @silverwind suggested, I started from validate-npm-package-name, but found this solution too complicated.
Then I tried to fix existing regex myself, but thought, that exclude all restricted symbols is harder, than set only allowed symbols.
Then I search a bit more and found package-name-regex and regex from it works for all new test cases.
Let me know, if more information or help with this PR is needed.