thombashi / pathvalidate

A Python library to sanitize/validate a string such as filenames/file-paths/etc.
https://pathvalidate.rtfd.io/
MIT License
210 stars 12 forks source link

Special chars not escaped in the error __str__ #9

Closed UncleGoogle closed 5 years ago

UncleGoogle commented 5 years ago
In [14]: try:
    ...:     pathvalidate.validate_filepath('asdf\rsdf')
    ...: except Exception as e:
    ...:     print(e)
    ...: 
    ...: 
sdf', reason=INVALID_CHARACTERars=(\
thombashi commented 5 years ago

Thank you for your report.

The error fixed at pathvalidate 0.28.2 as the following:

>>> pathvalidate.__version__
'0.28.2'
>>> try:
...     pathvalidate.validate_filepath('asdf\rsdf')
... except Exception as e:
...     print(e)
...
invalid char found: invalid-chars=('\r'), value=''asdf\rsdf'', reason=INVALID_CHARACTER

Please try to upgrade the package.

UncleGoogle commented 5 years ago

Thanks for instant fix! repr for greater good.