Fix MediaView extension handling as documented and expected.

This commit is contained in:
Mark Scherer 2015-08-21 12:35:49 +02:00
parent 0df0f1a559
commit f154a8f4d7

View file

@ -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;
@ -86,7 +86,12 @@ class MediaView extends View {
} }
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'));