-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Ports starting with multiple zeros pass the verification #2208
Comments
I has the same problem! 😢 |
Try this
// isPort
import isInt from './isInt';
export default function isPort(str) {
return isInt(str, { allow_leading_zeroes: false, min: 0, max: 65535 });
} |
This is the internal implementation of validatorjs, so I can't pass in options: https://github.com/validatorjs/validator.js/blob/master/src/lib/isPort.js At the same time, we need to think about how to configure the port format in 'isUrl' |
1 similar comment
This is the internal implementation of validatorjs, so I can't pass in options: https://github.com/validatorjs/validator.js/blob/master/src/lib/isPort.js At the same time, we need to think about how to configure the port format in 'isUrl' |
I will create PR but seems like maintainers are not actively merging PRs, that's why I’ve suggested you edit your local version. |
Describe the bug
When I add 0 in front of a port string, just like ‘00065535’,I expect false,but the function return true.
Examples
Source Code:
I can't configure the options of isInt when I use isPort api
Additional context
Validator.js version: 13.7.7
Node.js version: v16.12.0
OS platform: macOS
The text was updated successfully, but these errors were encountered: