]> git.ipfire.org Git - dbl.git/commitdiff
sources: Convert modification timestamps to UTC
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Feb 2026 17:56:47 +0000 (17:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Feb 2026 17:56:47 +0000 (17:56 +0000)
The asyncpg driver does not seem to like offset-aware and offset-unaware
timestamps.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dbl/sources.py

index 6bd7e41099ddc4068c4ff6448a00db480c8fc595..9e88b94ccdc06a71db740a21c04115789dcd431c 100644 (file)
@@ -381,7 +381,11 @@ class Source(sqlmodel.SQLModel, database.BackendMixin, table=True):
                # Store Last-Modified
                last_modified = headers.get("Last-Modified")
                if last_modified:
-                       self.last_modified_at = email.utils.parsedate_to_datetime(last_modified)
+                       # Parse the timestamp
+                       t = email.utils.parsedate_to_datetime(last_modified)
+
+                       # Store as UTC
+                       self.last_modified_at = t.replace(tzinfo=None)
 
                # Store the ETag
                self.etag = headers.get("ETag")