Remove any fraction from published time when checking recency

main
Bob Mottram 2022-05-08 16:06:24 +01:00
parent 9c419c2550
commit 05197552cb
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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,