You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

wen_hsiao's avatar
wen_hsiao
Explorer | Level 4
6 years ago

The /upload behavior has been changed ?

Recently,  we received many feedbacks from our product users that the filename (use /upload) has become garbled. We found the "path" decode behavior might be changed by dropbox server.

For Example: (the current behavior)

curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer access_token" \
--header "Dropbox-API-Arg: {\"path\": \"/RICE/我的檔案\",\"mode\": \"add\",\"autorename\": false,\"mute\": false}" \
--header "Content-Type: application/octet-stream" \
--data-binary test.pdf

{"name": "\u00e6\u0088\u0091\u00e7\u009a\u0084\u00e6\u00aa\u0094\u00e6\u00a1\u0088", "path_lower": "/rice/\u00e6\u0088\u0091\u00e7\u009a\u0084\u00e6\u00aa\u0094\u00e6\u00a1\u0088", "path_display": "/RICE/\u00e6\u0088\u0091\u00e7\u009a\u0084\u00e6\u00aa\u0094\u00e6\u00a1\u0088", "parent_shared_folder_id": "4082639392", "id": "id:Io0h0kFRW8sAAAAAANBUdA", "client_modified": "2019-10-09T08:32:39Z", "server_modified": "2019-10-09T08:32:39Z", "rev": "5947620b4879df3582220", "size": 38908, "sharing_info": {"read_only": false, "parent_shared_folder_id": "4082639392", "modified_by": "dbid:AADoF7JHXmoPd6Rx2X-1h0qzHUgXhnQfiH0"}, "is_downloadable": true, "content_hash": "cae9af2c924e769d376ed2143b0e8b0195b689764ac01be0ecc8e72b9a1feeb1"}

the decoded response "name" will be : æˆ‘的檔案

but in the past, the response "name" should be: \u6211\u7684\u6a94\u6848

which is the encoded string of "我的檔案"

 

 

  • Greg-DB's avatar
    Greg-DB
    6 years ago

    There was a change on our server stack that affected how we handled HTTP headers without proper encoding. That resulted in malformed file paths/names. We've reverted that change, so that should be working again, but please make sure your headers get encoded properly.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Thanks for the report! We'll look into whether something changed, but note that whenever you supply non-ASCII characters in HTTP headers, such as for the /upload endpoint, you should first encode them. We have documentation on this here:

    https://www.dropbox.com/developers/reference/json-encoding

    For example, you can see how this is done by the API v2 Explorer: (be sure to click "Show Code")

    https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload

     

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      This should be working again.

      However, please note that sending non-ASCII characters in HTTP headers is not officially supported, so please make sure to encode them as documented.

      • wen_hsiao's avatar
        wen_hsiao
        Explorer | Level 4

        We would follow the documentation,

        but the example request I stated works well for a long time (at least a year) ,

        Have you changed the behavior recently?