diff --git a/src/wikimore/app.py b/src/wikimore/app.py index af985f1..3990023 100644 --- a/src/wikimore/app.py +++ b/src/wikimore/app.py @@ -261,6 +261,17 @@ def wiki_article( soup = BeautifulSoup(article_html, "html.parser") body = soup.find("body") + + if not body: + return ( + render_template( + "article.html", + title="Error", + content="An error occurred while fetching the article.", + ), + 500, + ) + body.name = "div" redirect_message = soup.find("div", class_="redirectMsg")