diff options
author | default <nobody@localhost> | 2022-12-23 21:30:18 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-12-23 21:30:18 +0100 |
commit | e762d942de7a977ef8bbdc021e4cbb9a5a5f58fa (patch) | |
tree | ac0df547c277428f9fc47f24ec3341dbba2f0d1e /activitypub.c | |
parent | f9f6d965797e67ca76fb5e5464315961fb2e9d70 (diff) |
Don't rewrite the id unless it's different.
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c index ceb5d37..92e7c6c 100644 --- a/activitypub.c +++ b/activitypub.c @@ -92,15 +92,18 @@ int timeline_request(snac *snac, char **id, char *referrer) status = activitypub_request(snac, *id, &object); if (valid_status(status)) { - char *oid = *id; char *type = xs_dict_get(object, "type"); /* get the id again from the object, as it may be different */ - *id = xs_dict_get(object, "id"); + char *nid = xs_dict_get(object, "id"); - if (strcmp(*id, oid) != 0) + if (strcmp(nid, *id) != 0) { snac_debug(snac, 1, - xs_fmt("timeline_request canonical id for %s is %s", oid, *id)); + xs_fmt("timeline_request canonical id for %s is %s", *id, nid)); + + /* FIXME: nid points inside a dynamic block */ + *id = nid; + } if (!xs_is_null(type) && strcmp(type, "Note") == 0) { char *actor = xs_dict_get(object, "attributedTo"); |