Skip to content

File upload breaks with binary files #50

Closed
@scottsbaldwin

Description

@scottsbaldwin

When I use the JavaScript client to upload a binary file to a deal, the file gets corrupted. I see that issue #5 (which is closed) explains a fix was to use the file_path property. However, this only works for plain text files for me. When I use a binary file, I get the behavior that @alexandremaeda mentioned in #5.

Ultimately, I had to bypass using the JavaScript client completely and go straight to the API. I looked at how the Pipedrive web app did file uploads and saw that it used the form-data library. The gist below shows my solution using form-data. Because this solution deviates from the typical pattern in the JavaScript client for sending requests to the API, I did not create a pull request.

https://gist.github.com/scottsbaldwin/230465d8d90c9e05b37535dbc723c7ac

Could something like this be adapted to work in the API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions