Skip to content

Commit

Permalink
Handle undefined display_name and cw fields
Browse files Browse the repository at this point in the history
Can happen with RSS input.

Addresses issue robertoszek#126
  • Loading branch information
nemobis committed Jun 25, 2023
1 parent 9a64891 commit 8375c44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pleroma_bot/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def _get_instance_info(self):

def mastodon_enforce_limits(self):
for t_user in self.twitter_username:
if len(self.display_name[t_user]) > 30:
if t_user in self.display_name and len(self.display_name[t_user]) > 30:
self.display_name[t_user] = self.display_name[t_user][:30]
log_msg = _(
"Mastodon doesn't support display names longer than 30 "
Expand Down
2 changes: 1 addition & 1 deletion pleroma_bot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def main():
tweet["polls"],
tweet["possibly_sensitive"],
tweets_to_post["media_processed"],
cw=tweet["cw"]
cw=tweet.get("cw", None)
)
posted[tweet["id"]] = post_id
posts_ids = user.posts_ids
Expand Down

0 comments on commit 8375c44

Please sign in to comment.