capacitor-community / contacts

Contacts Plugin for Capacitor
https://capacitor-community.github.io/contacts/
125 stars 54 forks source link

iOS image payload assumes that Base64 is always a png. #101

Closed Danieltech99 closed 1 year ago

Danieltech99 commented 1 year ago

The code in this file assumes that the contact image is always a png and adds that in the metadata. Looking at logs, I think this can return other types (I believe I see some jpgs marked as pngs in my own use).

It would likely be advisable to add code to detect the image type and add the appropriate prefix.

https://github.com/capacitor-community/contacts/blob/975c43dc135fa0d97ce0ce138c9502f21bb7d378/ios/Plugin/ContactPayload.swift#L156

Danieltech99 commented 1 year ago

Swift/iOS is not currently my area of expertise, but wondering if this might be useful:

https://developer.apple.com/documentation/uikit/uiimage/1624096-pngdata

tafelnl commented 1 year ago

I've made a PR #102 that will fix this issue. Could please test if this solves your issue?

tafelnl commented 1 year ago

Shipped in latest release!