ringcentral / ringcentral-extensible

RingCentral Extensible SDK
10 stars 6 forks source link

Attaching images does not work as expected #69

Closed alexbegt closed 1 year ago

alexbegt commented 1 year ago

Calling any endpoint that needs certain parameters (for instance image) does not work as currently FormData is hardcoded to use the name of 'attachement'. This change was made for a test case of IVR audio upload, however this will now break certain endpoints such as updating a profile picture which is looking for form-data with the name of 'image'.

https://github.com/ringcentral/ringcentral-extensible/blob/master/packages/core/src/FormData.ts#L40 Is the incorrect line; Taking the commit from Jan 9th fixes the issue with the form data using a hardcoded name.

Maybe this should be a new field under the Attachment type to control what type the formdata is;

I got around this issue by taking a copy of the Utils code to create the formdata

alexbegt commented 1 year ago

Additionally, the updateUserProfileImage endpoint does not like when the requests.json is sent to it along with the image, if this is provided to the endpoint it throws back ACT-331 (Profile Image not valid).

tylerlong commented 1 year ago

Sorry for the late reply. Next time please create a ticket here to get timely response: https://developers.ringcentral.com/support/create-case

I am totally unaware of such an issue. Yes something is hard-coded, but all the test cases still pass. And as far as I can tell, server side doesn't care about the name "attachment", it cares about the filename instead.

Are you sure that "updating a profile picture" stops working? Let me check.

Update: I have reproduced the issue.

tylerlong commented 1 year ago

It seems that profile image uploading is the only place that is broken. I tried IVR audio and also fax sending, both worked. My goal was not to provide a general purpose form-data implementation. I just wanted to cover all RingCentral use cases. But I didn't test profile image.

tylerlong commented 1 year ago

Fixed: https://github.com/ringcentral/ringcentral-extensible/commit/87d0e1dccc97072f5b39155e31553d7126786d4f