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

Roon's avatar
Roon
Explorer | Level 4
8 years ago

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.
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    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

      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

        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

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 3 years ago
325 Following

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 or Facebook.

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!