From f433a6a1e8ee5f23d477f186d6c7a1b44e4698b7 Mon Sep 17 00:00:00 2001 From: "Bradley M. Froehle" Date: Mon, 21 Nov 2011 12:34:23 -0800 Subject: [PATCH] Issue #1229014 by bfroehle: Content-Disposition header makes private files show open/save prompts, but public files show inline. --- core/includes/file.inc | 10 ---------- core/modules/image/image.test | 1 - 2 files changed, 0 insertions(+), 11 deletions(-) diff --git a/core/includes/file.inc b/core/includes/file.inc index 6e6611f..0ea4bc1 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -2428,20 +2428,10 @@ function file_directory_temp() { function file_get_content_headers($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 . '; name="' . $name . '"', 'Content-Length' => $file->filesize, - 'Content-Disposition' => $disposition . '; filename="' . $name . '"', 'Cache-Control' => 'private', ); } diff --git a/core/modules/image/image.test b/core/modules/image/image.test index a29b4f3..057244e 100644 --- a/core/modules/image/image.test +++ b/core/modules/image/image.test @@ -687,7 +687,6 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase { // Only verify HTTP headers when using private scheme and the headers are // sent by Drupal. $this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png; name="' . $test_image->filename . '"', t('Content-Type header was sent.')); - $this->assertEqual($this->drupalGetHeader('Content-Disposition'), 'inline; filename="' . $test_image->filename . '"', t('Content-Disposition header was sent.')); $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'private', t('Cache-Control header was sent.')); // Log out and try to access the file. -- 1.7.7.2