Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Roon's avatar
Roon
Explorer | Level 4
9 years ago
Solved

Share Link Redirect URL has no Content-Length

I'm trying to get the filesize from a shared link:

 

 

Looking at the answer to [this post] - the shared link creates a redirect to the file, which should provide a filesize in the headers.. 

It seems that the "Content-Length" Header is no longer available on the redirect link. 

 

Is there an alternative method?

 

  • I don't believe there is a way to find out the size ahead of time unfortunately.

7 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    My sample there is still returning Content-Length for me. Can you share a sample and output that isn't working as expected for you? Thanks in advance!
  • Roon's avatar
    Roon
    Explorer | Level 4
    9 years ago

    Hi Greg, 

     

    heres my output 

    $ curl -I https://www.dropbox.com/sh/j1msw4e8dup2c5q/AAANYUWXcyBDgxVGkveU7AFla?dl=1
    HTTP/1.1 302 Found
    Server: nginx
    Date: Thu, 30 Nov 2017 11:03:23 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Cache-Control: no-cache
    Content-Security-Policy: sandbox
    Location: https://dl.dropboxusercontent.com/content_link_zip/liyObwdrElvSIeElexmq1AqHMTZhWtSFoGu0KKJOo63xs0INfWNSflheo9qjap41/file
    Pragma: no-cache
    Referrer-Policy: origin-when-cross-origin
    Set-Cookie: locale=en; Domain=dropbox.com; expires=Tue, 29 Nov 2022 11:03:23 GMT; Path=/; secure
    Set-Cookie: gvc=Mjk4NTU0NTY4OTI3NDA1ODI1NDAzMTI2Mjk5ODM5MTkxNzY2NDU0; expires=Tue, 29 Nov 2022 11:03:23 GMT; httponly; Path=/; secure
    Set-Cookie: flash=; Domain=dropbox.com; expires=Thu, 30 Nov 2017 11:03:23 GMT; Path=/; secure
    Set-Cookie: puc=; expires=Thu, 30 Nov 2017 11:03:23 GMT; httponly; Path=/; secure
    Set-Cookie: bang=; Domain=dropbox.com; expires=Thu, 30 Nov 2017 11:03:23 GMT; Path=/; secure
    Set-Cookie: t=Xdr_KsdQvptCBofiAcYwgGSY; Domain=dropbox.com; expires=Sun, 29 Nov 2020 11:03:23 GMT; httponly; Path=/; secure
    Set-Cookie: __Host-js_csrf=Xdr_KsdQvptCBofiAcYwgGSY; expires=Sun, 29 Nov 2020 11:03:23 GMT; Path=/; secure
    X-Content-Type-Options: nosniff
    X-Dropbox-Request-Id: 760ad66de5a8c9aa75c7e535a0491e38
    X-Frame-Options: DENY
    X-Robots-Tag: noindex, nofollow, noimageindex
    X-Xss-Protection: 1; mode=block
    Strict-Transport-Security: max-age=15552000; includeSubDomains

     

    and then if i try the redirect link directly (from the Location: xxx in the above)

     

    $ curl -I https://dl.dropboxusercontent.com/content_link_zip/liyObwdrElvSIeElexmq1AqHMTZhWtSFoGu0KKJOo63xs0INfWNSflheo9qjap41/file
    HTTP/1.1 200 OK
    Server: nginx
    Date: Thu, 30 Nov 2017 11:03:45 GMT
    Content-Type: application/zip
    Connection: keep-alive
    referrer-policy: no-referrer
    x-robots-tag: noindex, nofollow, noimageindex
    content-disposition: attachment; filename="AscentShared.zip"; filename*=UTF-8''AscentShared.zip
    set-cookie: uc_session=ouN6cNB5FrD7Kf0nDpzHHCXY6wLIJFZ2rRVH6pmLHsdY1JLMkHnoHzPQBCKnG1Pw; Domain=dropboxusercontent.com; httponly; Path=/; secure
    content-security-policy: referrer no-referrer
    x-dropbox-request-id: d3e420b20a4f94e73d00a6cc078b74c7
    pragma: public
    cache-control: max-age=0
    x-content-security-policy: referrer no-referrer
    x-webkit-csp: referrer no-referrer
    X-Server-Response-Time: 557
    Strict-Transport-Security: max-age=15552000; includeSubDomains
  • deFreitas's avatar
    deFreitas
    New member | Level 2
    9 years ago

    Content-Length is not required, Your shared link is a folder then Dropbox is probably dynamically zipping it, that is probably the reason why it have not a length

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    That's correct, my sample was a link for a file, so it can offer a Content-Length. Your example is a link for a folder, which is compressed on the fly, so the Content-Length isn't available.
  • Roon's avatar
    Roon
    Explorer | Level 4
    9 years ago
    Thanks..
    So I take that to mean that the compression is incomplete when the headers are sent.. and consequently there is no known size..
    Leading me to the question, how am i supposed to know the compressed file-size of a folder prior to downloading it? (I need to indicate progress as a percentage)



  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    I don't believe there is a way to find out the size ahead of time unfortunately.
  • sechel's avatar
    sechel
    Explorer | Level 3
    8 years ago

    Hey there,

    there is an easy solution to this question: Do a HEAD request with a Range:bytes=0- header. Then you will have a Content-Length header in the response 😀 Hope that helps, greetings

    Stefan

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

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!