I came across the following error. When i use the file_entity module to generate a download link to a file the download page uses the following headers:
$headers = array(
'Content-Type' => 'force-download',
'Content-Disposition' => 'attachment; filename="' . $file->filename . '"',
'Content-Length' => $file->filesize,
'Content-Transfer-Encoding' => 'binary',
'Pragma' => 'no-cache',
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Expires' => '0',
'Accept-Ranges' => 'bytes',
);It uses the file objects filename as the download file name. However, the filename is a changeable value. That means that when you change the name and lose the file extension in the name it doesn't give me a correct file for downloading.
I've made a patch that adds the actual file name from the uri instead of the filename. I will create that patch and add it to this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | file_entity-wrong-filename-when-downloading-2203831-13.patch | 553 bytes | fabianderijk |
Comments
Comment #1
fabianderijkComment #2
fabianderijkComment #4
fabianderijkComment #5
fabianderijkComment #6
fabianderijkComment #7
dave reidThis should be re-rolled using the following:
Comment #8
fabianderijkI've changed the patch. It is now using drupal_basename() function.
Comment #10
fabianderijkComment #13
fabianderijkHopefully....
Comment #14
fabianderijkComment #15
askibinski commentedjust stumbled upon this bug, patch works like a charm!
Thanks! +1 for getting this in.
Comment #16
aaron commentedComment #17
aaron commented13: file_entity-wrong-filename-when-downloading-2203831-13.patch queued for re-testing.
Comment #20
dave reidCommitted a modified version to 7.x-2.x. Thanks!
Comment #22
sheldonkreger commentedFollow up to this: #2278625: nginx_accel_redirect_file_transfer() accidentally is an implementation of hook_file_transfer()