fix crash when feedparser is crashing on a bad RSS

This commit is contained in:
Ploum 2024-04-23 13:07:23 +02:00
parent 339acef720
commit 9a7e88d01b
2 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- offpunk/netcache: fix IPv6 as an URL (bug #40)
- ansicat: display empty files (instead of opening them with xdg-open)
- fix escape sequence warning in python 3.12 (by Étienne Mollier) (Debian #1064209)
- ansicat : fix crash when feedparser is crashing on bad RSS
## 2.2 - February 13th 2023
- cache folder is now configurable through $OFFPUNK_CACHE_PATH environment variable (by prx)

View File

@ -877,10 +877,15 @@ class FeedRenderer(GemtextRenderer):
return "application/rss+xml"
def is_valid(self):
if _DO_FEED:
parsed = feedparser.parse(self.body)
try:
parsed = feedparser.parse(self.body)
except:
parsed = False
else:
return False
if parsed.bozo:
if not parsed:
return False
elif parsed.bozo:
return False
else:
#If no content, then fallback to HTML