I've ran into a strange bug where if an action to "download files" is added to a view page, and then in turn the page display is rendered with panels, the resulting downloads get corrupt. Not entirely sure of the source of the problem, but this patch fixes it :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gfed created an issue. See original summary.

gfed’s picture

Upon further investigation, it appears not setting the mimetype entirely works perfectly well in modern browsers.

das-peter’s picture

Status: Needs review » Needs work

I'd like to keep the headers as all code, I know of, aims to provide proper headers, trusting the guessing power of the browser (modern or not) doesn't seem like the best idea.
Could you please test if these headers work for you:

  $headers['Content-Type: application/zip, application/octet-stream'];
  $headers['Content-Transfer-Encoding: binary'];

Adding application/octet-stream apparently tells the browser to figure it out on its own if it's not happy with the previous header.

According to all information I found on a quick search application/zip is a viable and valid content header, so if something goes wrong I'd say it's not the header :|
The currently used content type is registered with iana: https://www.iana.org/assignments/media-types/application/zip which should make it a valid media type according to http://tools.ietf.org/html/rfc2616#section-14.17 -> http://tools.ietf.org/html/rfc2616#section-3.7 -> http://tools.ietf.org/html/rfc1590

http://stackoverflow.com/questions/20100445/zip-file-content-type-for-ht...
http://stackoverflow.com/questions/6977544/rar-zip-files-mime-type

gfed’s picture

Those headers indeed get the job done, nothing corrupted, awesome.