snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit e762d942de7a977ef8bbdc021e4cbb9a5a5f58fa
parent f9f6d965797e67ca76fb5e5464315961fb2e9d70
Author: default <nobody@localhost>
Date:   Fri, 23 Dec 2022 21:30:18 +0100

Don't rewrite the id unless it's different.

Diffstat:
Mactivitypub.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 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");