From 05197552cbcf6f3502a583e06365c83dd710f977 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 8 May 2022 16:06:24 +0100 Subject: [PATCH] Remove any fraction from published time when checking recency --- inbox.py | 2 ++ utils.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/inbox.py b/inbox.py index ef6498d68..d66615953 100644 --- a/inbox.py +++ b/inbox.py @@ -2505,6 +2505,8 @@ def _valid_post_content(base_dir: str, nickname: str, domain: str, if 'T' not in published: return False if 'Z' not in published: + print('REJECT inbox post does not use Zulu time format. ' + + published) return False if '.' in published: # converts 2022-03-30T17:37:58.734Z into 2022-03-30T17:37:58Z diff --git a/utils.py b/utils.py index 9a80fef27..967b4c56c 100644 --- a/utils.py +++ b/utils.py @@ -2753,6 +2753,8 @@ def is_recent_post(post_json_object: {}, max_days: int) -> bool: recently = days_since_epoch - max_days published_date_str = post_json_object['object']['published'] + if '.' in published_date_str: + published_date_str = published_date_str.split('.')[0] + 'Z' try: published_date = \ datetime.datetime.strptime(published_date_str,