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
Here's another example that doesn't do what I would expect (although perhaps I'm expecting the wrong thing?).
In pathvalidate 2.4.1:
>>> pathvalidate.validate_filename("")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/iac2/st/lib/python3.8/site-packages/pathvalidate/_filename.py", line 260, in validate_filename
FileNameValidator(
File "/home/iac2/st/lib/python3.8/site-packages/pathvalidate/_filename.py", line 134, in validate
validate_pathtype(
File "/home/iac2/st/lib/python3.8/site-packages/pathvalidate/_common.py", line 49, in validate_pathtype
raise ValidationError(
pathvalidate.error.ValidationError: reason=NULL_NAME, description=the value must be a not empty
That's consistent with the character removal, but the end result is not a valid filename, so I would have expected sanitize_filename() to raise an error here?
I can call validate_filename() after sanitize_filename() to take care of this. Is that what I should be doing, or should I be able to expect that sanitize_filename() either returns a usable filename or raises an error?
Cheers.
The text was updated successfully, but these errors were encountered:
Since pathvalidate 2.5.0, you can set null_value_handler to sanitize_filename function call.
This will change the function behavior when the value after sanitization is empty.
e.g. Raise exception when the value after sanitization is empty:
Here's another example that doesn't do what I would expect (although perhaps I'm expecting the wrong thing?).
In pathvalidate 2.4.1:
That's what I would expect.
That's consistent with the character removal, but the end result is not a valid filename, so I would have expected
sanitize_filename()
to raise an error here?I can call
validate_filename()
aftersanitize_filename()
to take care of this. Is that what I should be doing, or should I be able to expect thatsanitize_filename()
either returns a usable filename or raises an error?Cheers.
The text was updated successfully, but these errors were encountered: