diff --git a/app/soapbox/normalizers/attachment.ts b/app/soapbox/normalizers/attachment.ts index 06fba73ad8..23cce3686c 100644 --- a/app/soapbox/normalizers/attachment.ts +++ b/app/soapbox/normalizers/attachment.ts @@ -46,8 +46,18 @@ const normalizeUrls = (attachment: ImmutableMap) => { return attachment.mergeWith(mergeDefined, base); }; +// Ensure meta is not null +const normalizeMeta = (attachment: ImmutableMap) => { + const meta = ImmutableMap().merge(attachment.get('meta')); + + return attachment.set('meta', meta); +}; + export const normalizeAttachment = (attachment: Record) => { return AttachmentRecord( - normalizeUrls(ImmutableMap(fromJS(attachment))), + ImmutableMap(fromJS(attachment)).withMutations((attachment: ImmutableMap) => { + normalizeUrls(attachment); + normalizeMeta(attachment); + }), ); };