Skip to content
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

Inconsistent isSlug results with "." in the inputs #2383

Open
Zhuochengyu opened this issue Mar 27, 2024 · 2 comments
Open

Inconsistent isSlug results with "." in the inputs #2383

Zhuochengyu opened this issue Mar 27, 2024 · 2 comments
Labels

Comments

@Zhuochengyu
Copy link

Describe the bug
A clear and concise description of what the bug is.
IsSlug shows inconsistent results when I put "." in the inputs.

Examples
If applicable, add screenshots to help explain your problem.

> isSlug('i.am.not.a.slug')
false
> isSlug('slug.is.cool')
true

Additional context
Validator.js version: 13.11.0
Node.js version: v18.15.0
OS platform: macOs 12.6.3

@alinaghale88
Copy link
Contributor

@Zhuochengyu I have raised a pull request for the bug reported if you would like to review.

@jfaMan
Copy link

jfaMan commented Apr 17, 2024

@alinaghale88 @Zhuochengyu I came looking for an issue with iSlug as basically anything with a special character was passing for me. When using special characters, I noticed that the regex will only fail if the second character is a special character like in your first example. Any other position and it doesn't get caught. I think it has to do with the fact that the regex also requires the string to be at least 3 characters long. Once it's 3 characters long, special characters are not caught like your second example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants