Skip to content

Commit

Permalink
Fix MediaView extension handling as documented and expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Aug 21, 2015
1 parent 0df0f1a commit f154a8f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Cake/View/MediaView.php
Expand Up @@ -65,7 +65,7 @@ class MediaView extends View {
* @return void * @return void
*/ */
public function render($view = null, $layout = null) { 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); extract($this->viewVars, EXTR_OVERWRITE);


$path = $path . $id; $path = $path . $id;
Expand All @@ -86,7 +86,12 @@ public function render($view = null, $layout = null) {
} }


if ($name !== 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')); $this->response->file($path, compact('name', 'download'));


Expand Down

0 comments on commit f154a8f

Please sign in to comment.