Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Oh... I found small bug #17

Closed
boris-42 opened this Issue · 5 comments

4 participants

@boris-42

For example If you have form:

<form ...>
 <input type="text" name="email"/> 
 <input type="text" name="email"/>
 ... 
 <input type="submit"/>
</form>

And then try to make on server

req.assert("email", "Invalid email" ).notNull().isEmail();

throws error =)

Something like this:
TypeError: Object boris@pavlovic.me,test, has no method 'match'

So ten year old "hacker" with curl can easy drop my web site using such things=)

@ctavan
Owner

@pboris can you provide a more complete code sample to reproduce this issue? That would be great!

@smakinson

I have not tried to reproduce this, but I wonder if what pboris is seeing could be handled by changing to use the Validator prototype. I see on the node validator repo an example using it:

Validator.prototype.error = function (msg) {
    this._errors.push(msg);
    return this;
}

Maybe placing the error function on the instance lets a thrown error get through?

@ctavan
Owner

@smakinson can you provide an example?

@smakinson

Now that I am coming back to this and looking at the node-validator page again, I think I mis-spoke since error handlers can be added in both places. But I just saw an error like this on something else I am using and I'd guess he is seeing an error from calling match on something that is not a string. Perhaps a side effect from the chaining?

I have not written any code to investigate.

@rustybailey
Collaborator

Closing as this conversation was going nowhere and no has responded since 2013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.