commit e762d94

default  ·  2022-12-23 20:30:18 +0000 UTC
parent f9f6d96
Don't rewrite the id unless it's different.
1 files changed,  +7, -4
+7, -4
 1@@ -92,15 +92,18 @@ int timeline_request(snac *snac, char **id, char *referrer)
 2             status = activitypub_request(snac, *id, &object);
 3 
 4             if (valid_status(status)) {
 5-                char *oid  = *id;
 6                 char *type = xs_dict_get(object, "type");
 7 
 8                 /* get the id again from the object, as it may be different */
 9-                *id = xs_dict_get(object, "id");
10+                char *nid = xs_dict_get(object, "id");
11 
12-                if (strcmp(*id, oid) != 0)
13+                if (strcmp(nid, *id) != 0) {
14                     snac_debug(snac, 1,
15-                        xs_fmt("timeline_request canonical id for %s is %s", oid, *id));
16+                        xs_fmt("timeline_request canonical id for %s is %s", *id, nid));
17+
18+                    /* FIXME: nid points inside a dynamic block */
19+                    *id = nid;
20+                }
21 
22                 if (!xs_is_null(type) && strcmp(type, "Note") == 0) {
23                     char *actor = xs_dict_get(object, "attributedTo");