Skip to content
Permalink
Browse files

Fix MediaView extension handling as documented and expected.

  • Loading branch information...
dereuromark committed Aug 21, 2015
1 parent 0df0f1a commit f154a8f4d768fb7b276cac48ccfb697bf9d7c7a5
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/Cake/View/MediaView.php
@@ -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 @@ public function render($view = null, $layout = null) {
}
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'));

0 comments on commit f154a8f

Please sign in to comment.
You can’t perform that action at this time.