summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcatch2012-12-29 12:49:51 +0000
committercatch2012-12-29 12:49:51 +0000
commit5fbc23088c1d29c0cad9df9fc92dbb068a06756b (patch)
tree73563d65b8fab3fb02b1e495d6c77a2275ba2970
parent3241695dfa4eb09b95940deaa733d47612b50e12 (diff)
Issue #1229014 by bfroehle, jackbravo: Content-Disposition header makes private files show open/save prompts, but public files show inline.
-rw-r--r--core/modules/file/file.module10
-rw-r--r--core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php1
-rw-r--r--core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php1
3 files changed, 0 insertions, 12 deletions
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 193f442..1590f4e 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -561,20 +561,10 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
function file_get_content_headers(File $file) {
$name = mime_header_encode($file->filename);
$type = mime_header_encode($file->filemime);
- // Serve images, text, and flash content for display rather than download.
- $inline_types = variable_get('file_inline_types', array('^text/', '^image/', 'flash$'));
- $disposition = 'attachment';
- foreach ($inline_types as $inline_type) {
- // Exclamation marks are used as delimiters to avoid escaping slashes.
- if (preg_match('!' . $inline_type . '!', $file->filemime)) {
- $disposition = 'inline';
- }
- }
return array(
'Content-Type' => $type,
'Content-Length' => $file->filesize,
- 'Content-Disposition' => $disposition . '; filename="' . $name . '"',
'Cache-Control' => 'private',
);
}
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index 924bd2d..1cfda9f 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -83,7 +83,6 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
// Only verify HTTP headers when using private scheme and the headers are
// sent by Drupal.
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.');
- $this->assertEqual($this->drupalGetHeader('Content-Disposition'), 'inline; filename="' . $test_image->filename . '"', 'Content-Disposition header was sent.');
$this->assertTrue(strstr($this->drupalGetHeader('Cache-Control'),'private') !== FALSE, 'Cache-Control header was sent.');
// Log out and try to access the file.
diff --git a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
index de0f782..9b0c3d5 100644
--- a/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
+++ b/core/modules/picture/lib/Drupal/picture/Tests/PictureFieldDisplayTest.php
@@ -149,7 +149,6 @@ class PictureFieldDisplayTest extends ImageFieldTestBase {
// Only verify HTTP headers when using private scheme and the headers are
// sent by Drupal.
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', 'Content-Type header was sent.');
- $this->assertEqual($this->drupalGetHeader('Content-Disposition'), 'inline; filename="' . $test_image->filename . '"', 'Content-Disposition header was sent.');
$this->assertTrue(strstr($this->drupalGetHeader('Cache-Control'), 'private') !== FALSE, 'Cache-Control header was sent.');
// Log out and try to access the file.