From 67308b17d7399de59e8ad371541d8d80bde00919 Mon Sep 17 00:00:00 2001 From: William Panting Date: Fri, 8 Feb 2013 08:59:48 -0400 Subject: [PATCH] some datastreams were downloading into files without extensions --- includes/datastream.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index 74517d7c..d332d06f 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -37,7 +37,11 @@ function islandora_view_datastream(FedoraDatastream $datastream, $download = FAL header('Content-length: ' . $datastream->size); } if ($download) { - header("Content-Disposition: attachment; filename=\"{$datastream->label}\""); + // Browsers will not append all extensions. + $mime_detect = new MimeDetect(); + $extension = $mime_detect->getExtension($datastream->mimetype); + $filename = $datastream->label . '.' . $extension; + header("Content-Disposition: attachment; filename=\"$filename\""); } drupal_page_is_cacheable(FALSE); // Try not to load the file into PHP memory!