From 96e44d908cd261d47a936e9a38b76391fa8a6bb9 Mon Sep 17 00:00:00 2001 From: Jason Funk Date: Tue, 7 May 2013 09:16:13 -0500 Subject: [PATCH] Allow the developer to set the Content-Disposition header in Response::download() --- laravel/response.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/response.php b/laravel/response.php index f3508358..ece2c354 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -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; } /**