From 99b218fca448fec64c3fab870b5a7c7b490deca9 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 5 Jun 2024 22:33:37 +0200 Subject: [PATCH] plugin text syntaxes: fix empty string handling in `_remove_markups`. --- libervia/backend/plugins/plugin_misc_text_syntaxes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libervia/backend/plugins/plugin_misc_text_syntaxes.py b/libervia/backend/plugins/plugin_misc_text_syntaxes.py index 64fd01cf..a897c849 100644 --- a/libervia/backend/plugins/plugin_misc_text_syntaxes.py +++ b/libervia/backend/plugins/plugin_misc_text_syntaxes.py @@ -475,5 +475,7 @@ class TextSyntaxes(object): @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")