This is a follow-up issue for #1229014: Content-Disposition header makes private files show open/save prompts, but public files show inline.
file_get_content_headers() defines a variable named $name but it's not used.
It was used for the "Content-Disposition" header before the patch in #1229014: Content-Disposition header makes private files show open/save prompts, but public files show inline was committed. But it's not used currently.
function file_get_content_headers($file) {
$name = mime_header_encode($file->filename);
$type = mime_header_encode($file->filemime);
return array(
'Content-Type' => $type,
'Content-Length' => $file->filesize,
'Cache-Control' => 'private',
);
}
The variable was already removed in D8.
function file_get_content_headers(FileInterface $file) {
$type = Unicode::mimeHeaderEncode($file->getMimeType());
return array(
'Content-Type' => $type,
'Content-Length' => $file->getSize(),
'Cache-Control' => 'private',
);
}
https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/fu...
This variable isn't harmful but an existence of an unused variable is confusing for developers, I think.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | remove_unused_variable-2853160-2.patch | 419 bytes | hgoto |
Comments
Comment #2
hgoto commentedComment #3
smaaz commentedApplied and tested, the patch works cleanly.
Comment #4
renatog commentedHi guys.
It really makes sense.
Good Work.
Regards.
Comment #5
David_Rothstein commentedCommitted to 7.x - thanks!
Comment #8
David_Rothstein commentedReverted and committed it again, but this time crediting the correct people in the commit message.