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

max path length is confused with max filename length when validating/sanitizing filepaths #51

Open 7x11x13 opened 1 week ago

7x11x13 commented 1 week ago

Code to reproduce:

from pathvalidate import validate_filepath

p = "./" + "a" * 280
validate_filepath(p, platform="Linux")

This runs with no error. The expected output would be an error stating that the length of the filename is too long (280 > 255). I think the file path sanitizer should take two max length args: one for max filename length and one for max filepath length.