E592 atom: bug fix for attachment author objects with no properties · snarfed/granary@64df34a · GitHub
[go: up one dir, main page]

Skip to content

Commit 64df34a

Browse files
committed
atom: bug fix for attachment author objects with no properties
https://console.cloud.google.com/errors/CMPawqSghuDquwE
1 parent 84a76c6 commit 64df34a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ Changelog
309309
* Don't enclose bare URLs in `<`/`>` ([snarfed/bridgy#850](https://github.com/snarfed/bridgy/issues/850)).
310310
* Atom:
311311
* Bug fix for actors and attachments with multiple image URLs.
312+
* Bug fix for attachment author objects with no properties.
312313
* Google+:
313314
* Drop from web UI and API since [consumer Google+ is shutting down entirely](https://blog.google/technology/safety-security/expediting-changes-google-plus/) ([more](https://github.com/snarfed/bridgy/issues/846)).
314315
* Switch from deprecated global API endpoint to G+ endpoint. Background in [snarfed/bridgy#846](https://github.com/snarfed/bridgy/issues/846), [Google blog post](https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html) [and docs](https://developers.google.com/api-client-library/python/guide/batch).

granary/atom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def _prepare_activity(a, reader=True):
398398
author = att.get('author')
399399
if author:
400400
name = microformats2.maybe_linked_name(
401-
microformats2.object_to_json(author).get('properties', []))
401+
microformats2.object_to_json(author).get('properties') or {})
402402
html = '%s: %s' % (name.strip(), html)
403403
children.append(html)
404404

granary/tests/test_atom.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ def test_activity_to_atom_like(self):
175175
'object': obj,
176176
}), ignore_blanks=True)
177177

178+
def test_activity_to_atom_author_without_properties(self):
179+
"""https://console.cloud.google.com/errors/CMPawqSghuDquwE"""
180+
self.assertIn('<title>foo</title>', atom.activity_to_atom({
181+
'object': {
182+
'title': 'foo',
183+
'attachments': [{
184+
'objectType': 'article',
185+
'author': {
186+
'objectType': 'person'
187+
},
188+
}],
189+
}}))
190+
178191
def test_atom_to_activity_reply(self):
179192
expected = {
180193
'objectType': 'activity',

0 commit comments

Comments
 (0)
0