We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

wolfgangmeyers's avatar
wolfgangmeyers
Helpful | Level 5
2 years ago

409 error when attempting to download image files

This was working perfectly fine a few days ago when I was testing integration with aibrush.art. Now when my app makes requests for any files ending in .webp or .png, a 409 response is returned with no payload. If I download the corresponding .json file with image metadata, it downloads with no problem. Seems like an api issue.

  • Well, it has mysteriously stopped happening since I reported it. Someone must have caught the bug and fixed it 🙂

  • wolfgangmeyers's avatar
    wolfgangmeyers
    Helpful | Level 5

    Update - if I rename a file with a .webp or .png extension to end in _webp or _png respectively, the download works.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

    • the name and version number of the platform and SDK/library you are using, if any
    • the steps to reproduce the issue, including relevant code snippet(s)
    • the full text of any error or unexpected output, ideally including any/all headers and bodies for both request and response

    Please be sure to redact any sensitive values, such as any access tokens or refresh tokens.

    • wolfgangmeyers's avatar
      wolfgangmeyers
      Helpful | Level 5

      Thanks for the help!

      I'm using the "dropbox" npm package version 10.34.0.

      Here's a code snippet that shows the `Dropbox` instance being used to download the image file:

      const imageFileName = `image_filename.png`;
      const imageResult = (await this.dropbox.filesDownload({
      path: `/${imageFileName}`,
      })).result;

      For more context, here is a link to the place in my codebase that has the problem: https://github.com/wolfgangmeyers/aibrush-2/blob/main/src/lib/dropbox.ts#L167

      Request Headers:

      POST /2/files/download HTTP/1.1
      Accept: */*
      Accept-Encoding: gzip, deflate, br
      Accept-Language: en,en-US;q=0.9
      Authorization: Bearer <redacted>
      Connection: keep-alive
      Content-Length: 0
      Dropbox-API-Arg: {"path":"/0d433c25-8365-4933-a96f-6f07543a899f.png}"}
      Host: content.dropboxapi.com
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: cross-site
      User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
      sec-ch-ua: "Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"
      sec-ch-ua-mobile: ?0
      sec-ch-ua-platform: "Linux"


      Response Headers:

      HTTP/1.1 409 Conflict
      Access-Control-Allow-Origin: *
      Access-Control-Expose-Headers: Accept-Ranges, Content-Range, ETag, Dropbox-API-Result
      Cache-Control: no-cache
      Content-Security-Policy: sandbox allow-forms allow-scripts
      X-Content-Type-Options: nosniff
      Content-Type: application/json
      Accept-Encoding: identity,gzip
      Date: Mon, 31 Jul 2023 16:55:48 GMT
      Server: envoy
      Content-Length: 97
      Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
      X-Robots-Tag: noindex, nofollow, noimageindex
      X-Dropbox-Response-Origin: far_remote
      X-Dropbox-Request-Id: 05ee6d257ece4f0e849a94b9d15d4fa3


      If I change the file name to end in "_png" instead of ".png" and then download it, I get a 200 response and it downloads fine. Same happens with .webp files. The .json files that I'm using to store image metadata download without any issues.

    • wolfgangmeyers's avatar
      wolfgangmeyers
      Helpful | Level 5

      I just replied with all of the info you requested but my reply disappeared. Did you get the reply or do I need to repost it?

    • wolfgangmeyers's avatar
      wolfgangmeyers
      Helpful | Level 5

      Request headers:

      POST /2/files/download HTTP/1.1
      Accept: */*
      Accept-Encoding: gzip, deflate, br
      Accept-Language: en,en-US;q=0.9
      Authorization: Bearer <redacted>
      Connection: keep-alive
      Content-Length: 0
      Dropbox-API-Arg: {"path":"/0d433c25-8365-4933-a96f-6f07543a899f.png}"}
      Host: content.dropboxapi.com
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: cross-site
      User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
      sec-ch-ua: "Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"
      sec-ch-ua-mobile: ?0
      sec-ch-ua-platform: "Linux"

About Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 2 years ago
323 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!