patch 6bc0aa52a10f9031c5334801deaeba2b6ac0d2b0
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Feb 5 18:21:05 CET 2022
* telegram: optimize regular expression for sanitize filenames
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-22 15:59:27.554909624 +0100
+++ new-irgramd/telegram.py 2024-11-22 15:59:27.554909624 +0100
@@ -15,6 +15,7 @@
# Constants
TL_TYPES_IDENT = re.compile(r"<class 'telethon.tl.types.([^']+)'>")
+FILENAME_INVALID_CHARS = re.compile('[/{}<>()"\'\\|&]')
# Configuration
diff -rN -u old-irgramd/utils.py new-irgramd/utils.py
--- old-irgramd/utils.py 2024-11-22 15:59:27.554909624 +0100
+++ new-irgramd/utils.py 2024-11-22 15:59:27.554909624 +0100
@@ -44,4 +44,4 @@
return messages_limited
def sanitize_filename(fn):
- return re.sub('[/{}<>()"\'\\|&]', '', fn).strip('-').replace(' ','_')
+ return FILENAME_INVALID_CHARS.sub('', fn).strip('-').replace(' ','_')