Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

bmcdonald's avatar
bmcdonald
Explorer | Level 3
9 years ago

files/download can't handle files with embedded spaces

I have a file that has three spaces in the name.  When I try to use the API to download it I get a 409.  I have tried encoding the spaces as %20 + and even \u0020 and it always fails with a 409.  Please advise.

 

curl -X POST https://content.dropboxapi.com/2/files/download \ --header 'Authorization: Bearer <redacted>' \ --header 'Dropbox-API-Arg: {"path":"/DoNotDeleteFunctionalTest/TEST SPACES.txt"}' 
 
Result:
{
"error_summary": "path/not_found/...",
"error": {
".tag": "path",
"path": {
".tag": "not_found"
}
}
}

 

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Are you sure that's the right path? Spaces shouldn't be an issue, and this works fine for me:

    $ curl -X POST https://content.dropboxapi.com/2/files/upload \
    >     --header "Authorization: Bearer <redacted>" \
    >     --header "Dropbox-API-Arg: {\"path\": \"/DoNotDeleteFunctionalTest/TEST SPACES.txt\"}" \
    >     --header "Content-Type: application/octet-stream" \
    >     --data "some data here"
    
    {"name": "TEST SPACES.txt", "path_lower": "/donotdeletefunctionaltest/test spaces.txt", "path_display": "/DoNotDeleteFunctionalTest/TEST SPACES.txt", "id": "id:25N5ksooX-sAAAAAAAKNTQ", "client_modified": "2017-01-24T23:15:48Z", "server_modified": "2017-01-24T23:15:49Z", "rev": "6e1bb021eccc7", "size": 14, "content_hash": "16458e974c3451720370bd39a3b62451470dd77666d44b550138dec8583ee4ea"}
    
    $ curl -X POST https://content.dropboxapi.com/2/files/download \
    >     --header 'Authorization: Bearer <redacted>' \
    >     --header 'Dropbox-API-Arg: {"path":"/DoNotDeleteFunctionalTest/TEST SPACES.txt"}'
    some data here

    You can use /2/files/list_folder[/continue] to list the contents of the folder, in order to make sure you get the right path.

     

    Also, you mentioned it has three spaces in the name, but the path in the code you shared only has one. 

     

    Finally, I redacted the access token from your post, but you should revoke it since you posted it publicly.

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!