From 0f1b7fd1b9c609811c05b8ee1c739b80d31ac491 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <dev@cmatte.me>
Date: Thu, 11 Jun 2026 18:47:00 +0200
Subject: [PATCH] Fix crash when receiving a request with an incorrect
 If-Modified-Since header

---
 django/archives/mailarchives/views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/django/archives/mailarchives/views.py b/django/archives/mailarchives/views.py
index fe74f7c..f258d5d 100644
--- a/django/archives/mailarchives/views.py
+++ b/django/archives/mailarchives/views.py
@@ -482,7 +482,7 @@ def message(request, msgid):
     newest = calendar.timegm(max(threadstruct, key=lambda x: x['date'])['date'].utctimetuple())
     if 'HTTP_IF_MODIFIED_SINCE' in request.META and not settings.DEBUG:
         ims = parse_http_date_safe(request.META.get("HTTP_IF_MODIFIED_SINCE"))
-        if ims >= newest:
+        if ims is not None and ims >= newest:
             return HttpResponseNotModified()
 
     responses = [t for t in threadstruct if t['parentid'] == m.id]
-- 
2.54.0

