Allow the developer to set the Content-Disposition header in Response::download()

This commit is contained in:
Jason Funk 2013-05-07 09:16:13 -05:00
parent cffded660c
commit 96e44d908c
1 changed files with 7 additions and 2 deletions

View File

@ -202,9 +202,14 @@ public static function download($path, $name = null, $headers = array())
// off to the HttpFoundation and let it create the header text.
$response = new static(File::get($path), 200, $headers);
$d = $response->disposition($name);
// If the Content-Disposition header has already been set by the
// merge above, then do not override it with out generated one.
if (!isset($headers['Content-Disposition'])) {
$d = $response->disposition($name);
$response = $response->header('Content-Disposition', $d);
}
return $response->header('Content-Disposition', $d);
return $response;
}
/**