changeset 4258:ba28ca268f4a

plugin text syntaxes: fix empty string handling in `_remove_markups`.
author Goffi <goffi@goffi.org>
date Wed, 05 Jun 2024 22:33:37 +0200
parents 810f2b80146b
children 49019947cc76
files libervia/backend/plugins/plugin_misc_text_syntaxes.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_misc_text_syntaxes.py	Wed Jun 05 22:24:18 2024 +0200
+++ b/libervia/backend/plugins/plugin_misc_text_syntaxes.py	Wed Jun 05 22:33:37 2024 +0200
@@ -475,5 +475,7 @@
         @return: the cleaned string
         """
         cleaner = clean.Cleaner(kill_tags=["style"])
+        if not xhtml:
+            return ""
         cleaned = cleaner.clean_html(html.fromstring(xhtml))
         return html.tostring(cleaned, encoding=str, method="text")