kintone/js-sdk

A bug report about uploadFile in kintone/rest-api-client

Closed this issue · 4 comments

Target Package

Environment

  • Operating System: MAC OS
  • Browser: Chrome

Current Behavior

I upload the file to kintone through new KintoneRestApiClient().file.uploadFile(file), and then add the returned fileKey to the kintone attachment field,
Check the "Content-Type" of the attachment field in record event.
The "Content-Type" is normal when I upload png or text file
When I upload a pdf or javascript file, the "Content-Type" becomes "application/octet-stream".

We get the js file object through the "onChange" event of , and then upload it to kintone through the "uploadFile" method of kintone-rest-api-client.

Expected Behavior

When I upload a pdf or javascript file, the "Content-Type" will be same as 'pdf/javascript'

I uploaded file with XMLHttpRequest and set file type when convert file to blob object.
The “content-type” in kintone record was correct.
Maybe we should set file type when convert to blob object in intone-rest-api-client.
Thank you very much!

@h000780

Thanks for your reporting.
We are checking your issue and will reply to you soon.

@h000780

Thank you for your patients.
We decided to fix this issue by supporting auto-detect MIME-type.
You can follow us at #1893

@h000780

This issue is fixed by PR #1893

The fixing PR was released in @kintone/rest-api-client@3.3.0.