cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Export file: Size and content_hash mismatch?

Export file: Size and content_hash mismatch?

heavy-paper-user
Explorer | Level 3

Hi there,

We use the Dropbox API to fetch and export Paper documents.
Recently (like 2 days ago) we observed that the API is returning, what seems to us, inconsistent values.

For example, we added a trivial paper document (which had one emoji) and ran the following:


curl -i -X POST https://content.dropboxapi.com/2/files/export \
--header "Authorization: Bearer <token>" \
--header "Dropbox-API-Arg: {\"path\": \"/testfiles/Trivial Paper.paper\"}"

 

And got the response pasted below.
A few salient things:
- The Dropbox-Api-Result header says "size": 829, however the Content-Length/Original-Content-Length and the actual body are all 833 bytes
- Furthermore, the content_hash doesn't seem to match up with either the content hash of the full body (833 bytes) OR of the first or last 829 bytes of the body.
- FWIW, if I remove the emoji from the paper, then the "size" in the metadata returned and the Content-Length headers match up, but I still can't get the content hash to match up.

 

This seems to have started recently (in the last 2 days), prior to that the same fetches were working fine.


Would appreciate any guidance on this. Currently our sanity checks (on byte size and content hash) are failing.

Thanks very much!

 

(P.S. Raw HTTP response of above curl command pasted below)

----
HTTP/1.1 200 OK
Server: envoy
Date: Wed, 17 Feb 2021 07:27:07 GMT
Content-Type: text/html
Content-Length: 833
Vary: Accept-Encoding
Cache-Control: no-cache
Pragma: no-cache
Etag: W/"015ace578ceee32000000018fe46d40"
Dropbox-Api-Result: {"export_metadata": {"name": "Trivial Paper.html", "size": 829, "export_hash": "5735ebcc4387ce073968bdd5dd5a391dc83494a88a487fcc2c87801e624dec26", "paper_revision": 113}, "file_metadata": {"name": "Trivial Paper.paper", "path_lower": "/testfiles/trivial paper.paper", "path_display": "/testfiles/Trivial Paper.paper", "id": "id:zzZ_oD_6Z-AAAAAAAAAAEQ", "client_modified": "2020-08-15T07:27:37Z", "server_modified": "2020-08-15T07:27:37Z", "rev": "015ace578ceee32000000018fe46d40", "size": 200, "is_downloadable": false, "export_info": {"export_as": "html", "export_options": ["html", "markdown"]}, "content_hash": "77c5750f3cbff7c5268f69e63980655a2a75637e6772941f0e3c48b3a4010b45"}}
Accept-Ranges: bytes
Original-Content-Length: 833
X-Server-Response-Time: 811
X-Robots-Tag: noindex, nofollow, noimageindex
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Robots-Tag: noindex, nofollow, noimageindex
X-Dropbox-Request-Id: bfd5a6e63ceb4806a96f9422adc36443

<div dir="auto" style="font-weight: 400; font-size: 40px; line-height: 48px; padding-bottom: 25px;color: #1b2733; text-decoration: none;" class="ace-line "><span>Trivial Paper</span></div><div dir="auto" style="line-height: 26px;" class="ace-line "><span>This is a test </span><span><a target="_blank" data-target-href="https://help.dropbox.com/files-folders/paper/paper-2020-faqs" style="color: #47B5FA; text-decoration: none" href="https://help.dropbox.com/files-folders/paper/paper-2020-faqs" rel="noreferrer nofollow noopener">Paper 2020</a></span><span> doc. </span><span><img src="https://paper.dropboxstatic.com/static/img/ace/emoji/1f386.png?version=6.0.0" data-emoji-ch="🎆" height="16" alt="fireworks" title="fireworks"></span><span> </span></div><div dir="auto" style="line-height: 26px;" class="ace-line ">&nbsp;</div>

3 Replies 3

Greg-DB
Dropbox Staff

Thanks for the detailed report! We'll look into it and I'll follow up here once I have an update on this for you.

Greg-DB
Dropbox Staff

These issues should be fixed now. Please try again and let me know if you're still seeing any issues.

 

Also, note that for /2/files/export, you should compare the exported data with the 'export_hash' value, not the 'content_hash', since this is an export and not a direct download.

heavy-paper-user
Explorer | Level 3

Thanks Greg. Yes, sorry, we were using export_hash in our real code.

 

And yup, the tests that were catching this seem to have passed now. Thanks for the update!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    heavy-paper-user Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?