Problem
extractImageData in Util.js always prefixes downloaded image bytes with data:image/jpeg;base64, even when the WhatsApp message declares another image MIME type. This can mislabel PNG or WebP content and may cause downstream image consumers to decode it incorrectly.
Expected behavior
Images added to chat history should retain the MIME type supplied by the source message, with a safe fallback when that metadata is unavailable.
Suggested direction
Read the MIME type from the selected imageMessage (including quoted images) and use it when building the data URL. Keep the current JPEG fallback for messages without a MIME value.
Acceptance criteria
- Declared MIME types such as
image/png and image/webp are preserved.
- Images without MIME metadata still use a safe fallback.
- Both direct images and quoted images are handled.
- A focused unit test covers at least one non-JPEG MIME type.
Problem
extractImageDatainUtil.jsalways prefixes downloaded image bytes withdata:image/jpeg;base64,even when the WhatsApp message declares another image MIME type. This can mislabel PNG or WebP content and may cause downstream image consumers to decode it incorrectly.Expected behavior
Images added to chat history should retain the MIME type supplied by the source message, with a safe fallback when that metadata is unavailable.
Suggested direction
Read the MIME type from the selected
imageMessage(including quoted images) and use it when building the data URL. Keep the current JPEG fallback for messages without a MIME value.Acceptance criteria
image/pngandimage/webpare preserved.