fix: regression re: attachment handling

This commit is contained in:
Julian Lam
2024-02-20 14:19:50 -05:00
parent 31fd135f6e
commit 53d1c10ec4

View File

@@ -46,7 +46,7 @@ Notes.assert = async (uid, input, options = {}) => {
} }
// Parse ActivityPub-specific data if exists (if not, was parsed already) // Parse ActivityPub-specific data if exists (if not, was parsed already)
if (postData.hasOwnProperty('_activityPub')) { if (postData.hasOwnProperty('_activitypub')) {
const { to, cc, attachment } = postData._activitypub; const { to, cc, attachment } = postData._activitypub;
await Notes.updateLocalRecipients(id, { to, cc }); await Notes.updateLocalRecipients(id, { to, cc });
await Notes.saveAttachments(id, attachment); await Notes.saveAttachments(id, attachment);
@@ -115,7 +115,6 @@ Notes.saveAttachments = async (id, attachments) => {
const hash = crypto.createHash('sha256').update(url).digest('hex'); const hash = crypto.createHash('sha256').update(url).digest('hex');
const key = `attachment:${hash}`; const key = `attachment:${hash}`;
console.log('attachment key is', key);
bulkOps.hash.push([key, { mediaType, url, name, width, height }]); bulkOps.hash.push([key, { mediaType, url, name, width, height }]);
bulkOps.zset.score.push(idx); bulkOps.zset.score.push(idx);