Skip to content

fix(posting): Prevent TypeError when image/thumbnails metadata is not an array - #1853

Open
sentry[bot] wants to merge 1 commit into
developfrom
seer/fix/handle-legacy-image-metadata
Open

sentry[bot] wants to merge 1 commit into
developfrom
seer/fix/handle-legacy-image-metadata

Conversation

@sentry

@sentry sentry Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: .filter is not a function occurring in extractMetaData when editing older Hive posts. The issue arises because json_metadata.image or json_metadata.thumbnails from the blockchain can sometimes be a plain string (a single URL) instead of an array, due to the lack of strict schema in older blockchain data.

The previous code used (initialMeta.image ?? []) which only guarded against null or undefined values. A string value would pass this check, leading to .filter() being called on a non-array type.

The fix replaces (initialMeta.image ?? []) and (initialMeta.thumbnails ?? []) with (Array.isArray(initialMeta.image) ? initialMeta.image : []) and (Array.isArray(initialMeta.thumbnails) ? initialMeta.thumbnails : []) respectively. This ensures that these fields are always treated as arrays (or empty arrays if they are not arrays), preventing the TypeError.

Fixes ECENCY-NEXT-1GQM

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants