Tokens and IDs can't be empty, so raise a value error if they are.
This commit is contained in:
parent
5791a48b3f
commit
c12c9b6eb9
1 changed files with 6 additions and 1 deletions
|
@ -173,6 +173,9 @@ def sanitize_token(string):
|
|||
if len(string) > 512:
|
||||
raise ValueError
|
||||
|
||||
if string == "":
|
||||
raise ValueError
|
||||
|
||||
return string
|
||||
|
||||
|
||||
|
@ -195,12 +198,14 @@ def sanitize_string(string):
|
|||
|
||||
def sanitize_id(string):
|
||||
# type: (str) -> str
|
||||
|
||||
string = sanitize_string(string)
|
||||
|
||||
if len(string) > 128:
|
||||
raise ValueError
|
||||
|
||||
if string == "":
|
||||
raise ValueError
|
||||
|
||||
return string
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue