snarfed / granary

💬 The social web translator
https://granary.io
Creative Commons Zero v1.0 Universal
447 stars 57 forks source link

Incorrect use of `atom:uri` element #752

Closed imax9000 closed 4 months ago

imax9000 commented 4 months ago

https://github.com/snarfed/granary/blob/main/granary/atom.py#L265

  a = {
    'objectType': 'activity',
    'verb': _as1_value(entry, 'verb') or 'post',
    'id': _text(entry, 'id') or (obj['id'] if obj_elem is None else None),
    'url': _text(entry, 'uri') or (obj['url'] if obj_elem is None else None),
    'object': obj,
    'actor': _author_to_actor(entry, feed_author=feed_author),
    'inReplyTo': obj.get('inReplyTo'),
  }

atom:uri element doesn't do what you think it does. Correct way of getting a URL from an entry is href attribute of atom:link element.

snarfed commented 4 months ago

Ah, good catch, thank you! uri is evidently for authors. Fortunately this should generally a noop, since we're grabbing link here:

https://github.com/snarfed/granary/blob/e93dbd241f4c31d26a766b607b00e435b40b9a9f/granary/atom.py#L284

Still worth fixing though!