diff --git a/web/src/lib/messages/reply.ts b/web/src/lib/messages/reply.ts index accf57c2..1981e899 100644 --- a/web/src/lib/messages/reply.ts +++ b/web/src/lib/messages/reply.ts @@ -175,10 +175,17 @@ function draftyEntityMedia(msg: StoredMessage): QuoteMedia | null { // Prefer the first matching media entity -- a quoted message carries one primary attachment. for (const ent of doc.ent) { const data = ent.data || {}; - const asImage = () => - (typeof data.ref === 'string' || typeof data.val === 'string') - ? { image: { ref: typeof data.ref === 'string' ? data.ref : undefined, val: typeof data.val === 'string' ? data.val : undefined, mime: typeof data.mime === 'string' ? data.mime : undefined } } + const asImage = () => { + // This deployment's Drafty media carries its upload URL in `refurl` (both webapp-sent and + // script/iOS-sent messages -- see attachments.ts), with tinode's classic `ref`/inline `val` + // as the other accepted carriers. Missing all three -> not locally renderable. + const ref = + typeof data.refurl === 'string' ? data.refurl : typeof data.ref === 'string' ? data.ref : undefined; + const val = typeof data.val === 'string' ? data.val : undefined; + return ref || val + ? { image: { ref, val, mime: typeof data.mime === 'string' ? data.mime : undefined } } : null; + }; switch (ent.tp) { case 'IM': { const image = asImage();