]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/bkmk_robot_base.py
Fix(robots): Do not parse empty strings
[bookmarks_db.git] / Robots / bkmk_robot_base.py
index d8877c6f41c6b6f30c8d8ba4b8dbcec396e6c02b..52d6b563f1056c9ffe29a08299d59084d248be4e 100644 (file)
@@ -149,8 +149,9 @@ class robot_base(Robot):
                         if content_type.startswith(ctype):
                             is_html = True
                             break
-                    if content and is_html:
-                        parser = parse_html(content, charset, self.log)
+                    content_stripped = content.strip()
+                    if content_stripped and is_html:
+                        parser = parse_html(content_stripped, charset, self.log)
                         if parser:
                             bookmark.real_title = parser.title
                             icon = parser.icon
@@ -246,7 +247,7 @@ class robot_base(Robot):
                                                   % (url, timeout)
                                                   )
 
-                    if not content:
+                    if not content_stripped:
                         self.log("   empty response, no content")
                     if not is_html:
                         self.log("   not html")