Przeglądaj źródła

[webpages] Bail if we can't get text

Colin Powell 3 miesięcy temu
rodzic
commit
760575e41d
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      vrobbler/apps/webpages/models.py

+ 3 - 0
vrobbler/apps/webpages/models.py

@@ -141,6 +141,9 @@ class WebPage(ScrobblableMixin):
             self.save(update_fields=["domain"])
 
     def _update_title_from_web(self, raw_text: str, save=False):
+        if not raw_text:
+            return
+
         self.title = raw_text[
             raw_text.find("<title>") + 7 : raw_text.find("</title>")
         ]