Skip to content

Handle Non-ASCII Characters in Dropbox-API-Arg header #106

@ina-yuzen

Description

@ina-yuzen

When the path contains non-ASCII characters, attempting to upload or download files results in the following error: DropboxApi::Errors::HttpError: HTTP 400.

According to the Dropbox documentation, arguments should be escaped to Unicode escape sequences like \uXXXX:
https://www.dropbox.com/developers/reference/json-encoding

If you use the Dropbox-API-Arg header, you need to make it "HTTP header safe". This means using JSON-style "\uXXXX" escape codes for the character 0x7F and all non-ASCII characters.

Currently, the arguments are sent using JSON.dump(params) in DropboxApi::Endpoints::ContentDownload and DropboxApi::Endpoints::ContentUpload, which does not escape non-ASCII characters. This leads to the HTTP 400 error when non-ASCII characters are present in the path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions