Forum Discussion

kamzata's avatar
kamzata
Explorer | Level 3
4 years ago

Since 31/01/22 all the download files become corrupted.

I own a Magento 1.9.4.2 store which has only downloadable products in it. Once a customer buy a digital product, Magento sends an email with the download link generated by Magento itself from the Dropbox one. This is worked since 2013 from 31/01/22. Suddenly, it doesn't work anymore. All the download files, past and present, become corrupted once downloaded!

 

This is a big issue for me. What's happened?

 

I also tried to restore my store from a 20/01/22 backup, but nothing's changed. It still doesn't work!

 

Dropbox, what's happened?

 

______________________

Edit:

 

I checked the file types:

  • Downloaded from Magento link [Corrupted]: application/octet-stream; charset=binary
  • Downloaded from Dropbox link [Ok]: application/zip; charset=binary

20 Replies

Replies have been turned off for this discussion
  • kamzata's avatar
    kamzata
    Explorer | Level 3
    4 years ago

    Solved!

     

    Just comment out the lines in the controller responsible for set the header "Content-Length" and then set the header  "Transfer-Encoding: chunked".

     

    File: app/code/core/Mage/Downloadable/controllers/DownloadController.php

     

    on _processDownload method on line 73 comment out these lines and add this other:

     

    ...
    protected function _processDownload($resource, $resourceType)
            ....
    
            // if ($fileSize = $helper->getFilesize()) {
            //     $this->getResponse()
            //         ->setHeader('Content-Length', $fileSize);
            // }
    
            $this->getResponse()
            ->setHeader('Transfer-Encoding', 'chunked');
    
            ....
            }

     

    Now it works but could you please tell me if there are some other headers to add or remove?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Thanks for following up. I'm glad to hear you got this working. I can't provide guidance on what other headers you should or shouldn't be setting though, as that depends on how the app works and what the app does.

  • kamzata's avatar
    kamzata
    Explorer | Level 3
    4 years ago

    Sure, I understand. However, did you guys change just that recently?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Yes, that update was deployed towards the end of January.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Update: in order to temporarily accommodate clients that don’t properly support automatically handling “Transfer-Encoding: chunked”, we’re temporarily rolling back this change, so that these links will no longer use “Transfer-Encoding: chunked” and will instead return “Content-Length” on HTTP/1.1. We will begin rolling that out starting around 2/17. That will be in place until around 3/1. At that point, we will begin using “Transfer-Encoding: chunked” and no longer returning “Content-Length” on HTTP/1.1 again.


    Going forward, please ensure that your clients are able to automatically handle both chunked encoding and non-chunked encoding automatically.

  • kamzata's avatar
    kamzata
    Explorer | Level 3
    4 years ago

    Then I'll set it like this:

     

    if ($fileSize = $helper->getFilesize()) {
        $this->getResponse()->setHeader('Content-Length', $fileSize);
    } else {
        $this->getResponse()->setHeader('Transfer-Encoding', 'chunked');
    }
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Update: the team has been able to complete some further updates to our infrastructure to be able to support the previous non-chunked behavior going forward indefinitely. That means that we plan to continue returning Content-Length (and not 'Transfer-Encoding: chunked') in the future and will not be reverting this as previously planned. (Regardless, for HTTP compatibility in general, we still recommend you make sure your HTTP clients support both types.) Hope this helps!

  • kamzata's avatar
    kamzata
    Explorer | Level 3
    2 years ago

    I noticed, since around September/October 2023, downloads really often (8 in 10 times) are interrupted at different size. And just now I remembered this issue.

     

    Did you change something again?

     

    I also opened this thread.

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!