mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix MediaView extension handling as documented and expected.
This commit is contained in:
parent
0df0f1a559
commit
f154a8f4d7
1 changed files with 7 additions and 2 deletions
|
@ -65,7 +65,7 @@ class MediaView extends View {
|
|||
* @return void
|
||||
*/
|
||||
public function render($view = null, $layout = null) {
|
||||
$name = $download = $id = $modified = $path = $cache = $mimeType = $compress = null;
|
||||
$name = $extension = $download = $id = $modified = $path = $cache = $mimeType = $compress = null;
|
||||
extract($this->viewVars, EXTR_OVERWRITE);
|
||||
|
||||
$path = $path . $id;
|
||||
|
@ -86,7 +86,12 @@ class MediaView extends View {
|
|||
}
|
||||
|
||||
if ($name !== null) {
|
||||
$name .= '.' . pathinfo($id, PATHINFO_EXTENSION);
|
||||
if (empty($extension)) {
|
||||
$extension = pathinfo($id, PATHINFO_EXTENSION);
|
||||
}
|
||||
if (!empty($extension)) {
|
||||
$name .= '.' . $extension;
|
||||
}
|
||||
}
|
||||
$this->response->file($path, compact('name', 'download'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue