GitHub
Moderator
[Directories.sanitizeFilname] various fixes
Most Unix file systems typically allow filenames of up to 255 bytes. However, the actual number of characters allowed can vary due to the representation of Unicode characters. Therefore length checks must be done in bytes, not unicode.
Also remove re.split(r"/|\\", filename) because we obviously can't split on character that have already been removed by the blacklist. Remember this function is supposed to process a prospective filename, not a path.
Add a max length argument so we can command lengths other than 255.
Continue reading...
Most Unix file systems typically allow filenames of up to 255 bytes. However, the actual number of characters allowed can vary due to the representation of Unicode characters. Therefore length checks must be done in bytes, not unicode.
Also remove re.split(r"/|\\", filename) because we obviously can't split on character that have already been removed by the blacklist. Remember this function is supposed to process a prospective filename, not a path.
Add a max length argument so we can command lengths other than 255.
Continue reading...