Skip to content

Commit

Permalink
Post.content can’t be None, don’t try to fetch empty URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcwatson committed May 10, 2024
1 parent d3866e4 commit 41322eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions activities/models/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,10 @@ def by_ap(cls, data, create=False, update=False, fetch_author=False) -> "Post":
try:
# apparently sometimes posts (Pages?) in the fediverse
# don't have content, but this shouldn't be a total failure
post.content = get_value_or_map(data, "content", "contentMap")
post.content = get_value_or_map(data, "content", "contentMap") or ""
except ActivityPubFormatError as err:
logger.warning("%s on %s", err, post.url)
post.content = None
post.content = ""
# Document types have names, not summaries
post.summary = data.get("summary") or data.get("name")
if not post.content and post.summary:
Expand Down
3 changes: 2 additions & 1 deletion users/services/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ def handle_internal_sync_actor(cls, payload):
) as pool:
# Do all the fetching in threads using a single client
for fn, url, action in pipeline:
future_actions[pool.submit(fn, client, url)] = action
if url:
future_actions[pool.submit(fn, client, url)] = action
# Re-submit the updates to happen in threads as well
for f in concurrent.futures.as_completed(future_actions):
pool.submit(future_actions[f], f.result())
Expand Down

0 comments on commit 41322eb

Please sign in to comment.