From a841d779b6a9eeb6b70249f93b12d4448910dc2e Mon Sep 17 00:00:00 2001 From: John Choi Date: Wed, 18 Dec 2024 14:34:53 +0900 Subject: [PATCH] rss.from_as1: remove possible addition of invalid author element --- granary/rss.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/granary/rss.py b/granary/rss.py index 7a0c64fd..21e24b18 100644 --- a/granary/rss.py +++ b/granary/rss.py @@ -120,13 +120,11 @@ def from_as1(activities, actor=None, title=None, feed_url=None, item.category(categories) author = as1.get_object(obj, 'author') - author = { - 'name': (author.get('displayName') or author.get('username') - or author.get('url') or author.get('id')), - 'uri': author.get('url') or author.get('id'), - 'email': author.get('email') or '-', - } - item.author(author) + if 'email' in author: + # author is optional in RSS 2.0 item spec, + # but if present, must be the email address of the author + # ref: https://www.rssboard.org/rss-specification#ltauthorgtSubelementOfLtitemgt + item.author(author={'email': author.get('email')}) published = obj.get('published') or obj.get('updated') if published and isinstance(published, str):