-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
Sanitize an optional parameter #425
Comments
Duplicate of the closed #205 apparently |
Not really; your issue is with express-validator v4, and #205 is from v2 age. Anyway, I can see the bug in the code; the sanitizers run before the code that filters out optional fields. Thanks for pointing it out. |
I know #205 is from v2, but the user reported a behavior that is exactly the same that I encountered. Anyway I'd love to have time to make a PR... I'll see if it'll be possible! |
Any update on this? Since |
Fix published in v4.2.1. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi everybody, thanks for your work! This is a great module :)
I have this check:
check('url').optional()
and I'd like to sanitize it escaping the string.So I obviously did:
check('url').optional().escape()
but it returns TypeError from validator.js telling me that it isn't a string (when the value isnt't there right because it's optional)How can I handle this?
The text was updated successfully, but these errors were encountered: