cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

/files/download API fails

/files/download API fails

simotin13
Helpful | Level 5

Hi,
I'm using Dropbox API and found /files/download API fails since few days before.

The API return following response body,


<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dropbox - 400</title>
<link href="https://cfl.dropboxstatic.com/static/metaserver/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="https://cfl.dropboxstatic.com/static/images/favicon.ico"/>
</head>
<body>
<div class="figure">
<img src="https://assets.dropbox.com/www/en-us/illustrations/spot/target-miss.svg" alt="Error: 400"/>
</div>
<div id="errorbox">
<h1>Error (400)</h1>Something went wrong. Don't worry, your files are still safe and the Dropbox team has been notified. Check out our <a href="https://status.dropbox.com">Status Page</a> to see if there is a known incident, our <a href="https://www.dropbox.com/help">Help Center</a> and <a href="https://forums.dropbox.com">forums</a> for help, or head back to <a href="https://www.dropbox.com/home">home</a>.
</div>

 

some APIs are still works successfully ex.(/get_metadata, /list_folder, /get_thumbnail), but '/files/download' fail.

Is there any information about this issue?

Thanks in advance simotin13

13 Replies 13

Здравко
Legendary | Level 20

@Nico-Uretek wrote:

..., Dropbox block now every special character and ... (not in accordance with the documentation haha). ...


@Nico-Uretek, It depends on what you mean here. It's according Dropbox documentation, but NOT according standards. For instance, Dropbox (note the usage of Dropbox, not Dropbox API nor SDK) doesn't support all UNICODE symbols, but only those in Basic Multilingual Plane. 🤷 This is Dropbox core bug! Of course, the same results in impossible usage of surrogate pairs during JSON encoding - they are invalid according Dropbox API.

Do you use such symbols as file/folder names?

Nico-Uretek
Helpful | Level 5

@Greg-DB Yes I still got the problems.
I'm using Dropbox on Salesforce and using two way to upload files (both didn't works since yesterday)

- by using the official dropbox package "Dropbox for Salesforce" (apiName "Dropbox_for_SF") version 1.704

- by using a custom code in apex (like java) that create an http request on the 

https://content.dropboxapi.com/2/files/upload with this code : 
            HttpRequest req = new HttpRequest();
            req.setEndpoint('https://content.dropboxapi.com/2/files/upload');
            req.setMethod('POST');
            String auth = 'Bearer '+tk;
            String content = 'application/octet-stream';
            String dbApiArg = '{\"path\": \"'+path+'/'+ a.name.replace('(xxx)','+') +'\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false}';
            Blob blobBodyValue = a.body;
            req.setHeader('Authorization', auth);
            req.setHeader('Content-Type', content);
            req.setHeader('Dropbox-API-Arg', dbApiArg);
            req.setBodyAsBlob(blobBodyValue);
            Http http = new Http();
            HTTPResponse res = http.send(req);
 
The fact is that my code and the package was working since year and no modifications has been dones ! Other Api like list_folder or download still working. All my organization have this issue.
I've test multiples times the upload api and without accents/special characters its work fine. But the management of the files is full automatised so we can't modify the file name to remove problematic characters....
 
Thanks you @Greg-DB 

@Здравко oh okay thanks ! Yes i'm using (french) accents and just the - characters in my name files and it would take a lot of time and devs to remove all of them... 

Здравко
Legendary | Level 20

@Nico-Uretek wrote:

... Yes i'm using (french) accents and just the - characters in my name files and it would take a lot of time and devs to remove all of them... 


No, no, this is not and cannot be an issue - it's not a surrogate pair! There is something else though:


@Nico-Uretek wrote:

...

            String dbApiArg = '{\"path\": \"'+path+'/'+ a.name.replace('(xxx)','+') +'\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false}';
...
            req.setHeader('Dropbox-API-Arg', dbApiArg);
... 

Where is your string encoding above? 🤔 I cannot see it! That's what makes your issues. 😉

Hope this helps.

 

PS: Missing of any try for encoding (including for such symbols that have to be encoded not only according Dropbox, but mandatory according applicable standards) makes your code instable or even vulnerable - the JSON object may become restructured by just "appropriate" path/file!!!

Greg-DB
Dropbox Staff

@Nico-Uretek I don't actually see any encoding being done on your header values in your code. Please make sure you have the encoding implemented as covered here.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Nico-Uretek Helpful | Level 5
What do Dropbox user levels mean?