thombashi / pathvalidate

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

validate len of every windows path part #10

Closed UncleGoogle closed 4 years ago

UncleGoogle commented 5 years ago
long_part = 'a'*261
invalid_path = pathlib.Path.home() / long_part / 'another_part'

# windows limit suppressed but still there is 259 limit of the every middle part of path
invalid_path = '\\\\?\\' + str(pathlib.Path.home() / long_part / 'file.exe')

pathvalidate.validate_filepath(str(invalid_path), max_len=1024)  # no error
pathlib.Path(invalid_path).mkdir(parents=True)  # OSError: [WinError 123]
thombashi commented 4 years ago

Thank you for your report.

The problem fixed at pathvalidate 0.29.1.