Changeset f9b1c5c in Klonkt


Ignore:
Timestamp:
07/30/2026 12:28:25 PM (6 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
6a99668
Parents:
1f640ff
Message:

C2S replies dragen hun media: de 502 op een foto-reply

Robins schermafdruk (30-7): Server said 502: reply_failed op een reply
met een foto. De C2S-ingest gaf bij replies alleen de platte tekst door
aan deliverReply; de attachments en de rich html werden stil gedropt.
Een foto-reply MET tekst kwam dus kaal aan, en een foto-only reply
faalde hard (geen tekst, geen media, deliverReply weigert terecht).

De ingest normaliseert nu de attachments (absolute eigen /media-URLs
naar relatief, zoals de direct-note-leg al deed) en geeft ze samen met
object.content als html en de taal door. deliverReply valideerde media
al zelf (eigen /media, image|audio|video, max 4) en kent de media-only
reply als geldige reply.

Changed files:
src/services/ActivityPubService.js

  • reply-branch in ingestOutboxActivity: attachments genormaliseerd en doorgegeven, html en language mee

remarks: de glue is in-memory niet te dekken (resolveRemoteNote is
altijd netwerk); de attachment-validatie zelf zit al in de bestaande
deliverReply-tests. 345 tests groen.

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r1f640ff rf9b1c5c  
    23212321          const parent = await resolveRemoteNote(c2sIdOf(object.inReplyTo)).catch(() => null);
    23222322          if (!parent) return { status: 502, error: 'cannot_resolve_inReplyTo' };
     2323          // The attachments ride along (Robins melding, 30-7: "502
     2324          // reply_failed" op een reply met een foto): deliverReply validates
     2325          // them itself (own /media only, image|audio|video, max 4) and a
     2326          // media-only reply is a valid reply there. Dropping them here made
     2327          // a photo reply arrive naked, and a photo-ONLY reply fail outright.
     2328          const atts = (Array.isArray(object.attachment) ? object.attachment : [])
     2329            .map((a) => a && typeof a === 'object' ? {
     2330              url: String(a.url || '').replace(new RegExp('^' + base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')), ''),
     2331              mediaType: String(a.mediaType || ''),
     2332              name: String(a.name || '').slice(0, 120),
     2333            } : null)
     2334            .filter(Boolean);
    23232335          // Honour the client's visibility for the reply: 'friends' (followers-
    23242336          // only, the Shaer detail-view Reply) drops Public; anything else stays
    23252337          // quiet-public. 'direct' was already handled above.
    2326           const r = await deliverReply(site, { postId: parent.localPostId || '', postSlug: null, parent, text: plain, visibility: c2sVisibility(object) });
     2338          const r = await deliverReply(site, {
     2339            postId: parent.localPostId || '', postSlug: null, parent, text: plain,
     2340            html: object.content || null, attachments: atts,
     2341            language: object.language || null, visibility: c2sVisibility(object),
     2342          });
    23272343          if (!r || !r.id) return { status: 502, error: 'reply_failed' };
    23282344          return { status: 201, id: r.id, url: `${base}/ap/notes/${r.id}` };
Note: See TracChangeset for help on using the changeset viewer.