You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default length of 0 is incorrect; it should be -1. And no we can't just change the 0 to a -1 in that awful x and y or z mess otherwise the empty string would incorrectly set length to -1.
I've added three tests for the Length validator to stress-test the difference between the None missing string and the '' empty string.
The text was updated successfully, but these errors were encountered:
PR incoming.
Actual Behavior
WTForm's
Length
validator incorrectly approves a missing string (akafield.data
isNone
) whenmin=0
, whereas it should fail validation.I interpret
min=-1
to mean 'no minimum length, permitNone
and the empty string''
'I interpret
min=0
to mean 'minimum length 0, do not permitNone
, aka a missing field, but do permit the empty string''
'Serving the following app with
$ gunicorn min-len-fail:app
on the default localhost:8000Test POSTing
title
both as missing, and as the empty string, with curlThe Length validator reports success for both cases, whereas it should fail the first.
Expected Behavior
With the PR incoming
Environment
Cause
The default length of
0
is incorrect; it should be-1
. And no we can't just change the0
to a-1
in that awfulx and y or z
mess otherwise the empty string would incorrectly setlength
to-1
.I've added three tests for the
Length
validator to stress-test the difference between theNone
missing string and the''
empty string.The text was updated successfully, but these errors were encountered: