Queer European MD passionate about IT
Browse Source

Make the regex dot match any character at all, including a newline, when cleaning HTML strings (so multiline tag bodies are allowed, as they are in Telegram HTML markdown).

davte 1 year ago
parent
commit
27f9d62cf9
2 changed files with 3 additions and 2 deletions
  1. 1 1
      davtelepot/__init__.py
  2. 2 1
      davtelepot/utilities.py

+ 1 - 1
davtelepot/__init__.py

@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.8.10"
+__version__ = "2.8.11"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 2 - 1
davtelepot/utilities.py

@@ -1450,7 +1450,8 @@ def clean_html_string(text: str) -> str:
             rf'(?P<opening><{tag}{attribute}>)'
             rf'(?P<body>.*?)'
             rf'(?P<close></{tag}>)',
-            text
+            text,
+            flags=re.DOTALL
         )
         if match and (first_match is None or match.start() < first_match.start()):
             first_match = match