patch 987c7436cd18763a950f5799ef5fac6e7cb127e4 Author: E. Bosch Date: Mon Dec 18 21:18:42 CET 2023 * telegram, utils: Replace invalid characters in filenames with number sequences instead of just removing. This will prevent some filename collisions in corner cases. diff -rN -u old-irgramd/utils.py new-irgramd/utils.py --- old-irgramd/utils.py 2024-11-01 02:29:41.213591232 +0100 +++ new-irgramd/utils.py 2024-11-01 02:29:41.213591232 +0100 @@ -81,7 +81,12 @@ return messages_limited def sanitize_filename(fn): - return FILENAME_INVALID_CHARS.sub('', fn).strip('-').replace(' ','_') + cn = str(sanitize_filename.cn) + new_fn, ns = FILENAME_INVALID_CHARS.subn(cn, fn) + if ns: + sanitize_filename.cn += 1 + return new_fn.strip('-').replace(' ','_') +sanitize_filename.cn = 0 def add_filename(filename, add): if add: