[BUGFIX] Valid Content-Type header for jpg thumbnails 82/39482/3
authorStephan Großberndt <stephan@grossberndt.de>
Tue, 12 May 2015 11:07:32 +0000 (13:07 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 15 May 2015 12:53:03 +0000 (14:53 +0200)
Use "Content-Type: image/jpeg" instead of invalid "image/jpg" derived
from the file extension. The invalid Content-Type in combination with
"X-Content-Type-Options: nosniff" leads to thumbnails not showing up in
Internet Explorer.

While at it also correct the case of "Etag" to "ETag".

Resolves: #66913
Releases: master, 6.2
Change-Id: I9a31817e32e4e8b2b99b3008f8381608c5ac06e9
Reviewed-on: http://review.typo3.org/39482
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/View/ThumbnailView.php
typo3/sysext/t3editor/res/tsref/tsref.xml

index e0164b8..7a4bee0 100644 (file)
@@ -225,9 +225,9 @@ class ThumbnailView {
                                // The thumbnail is read and output to the browser
                                if ($fd = @fopen($this->output, 'rb')) {
                                        $fileModificationTime = filemtime($this->output);
-                                       header('Content-type: image/' . $outext);
+                                       header('Content-Type: image/' . ($outext === 'jpg' ? 'jpeg' : $outext));
                                        header('Last-Modified: ' . date('r', $fileModificationTime));
-                                       header('Etag: ' . md5($this->output) . '-' . $fileModificationTime);
+                                       header('ETag: ' . md5($this->output) . '-' . $fileModificationTime);
                                        // Expiration time is chosen arbitrary to 1 month
                                        header('Expires: ' . date('r', ($fileModificationTime + 30 * 24 * 60 * 60)));
                                        fpassthru($fd);
index 2a5623a..be4ebe2 100644 (file)
@@ -783,7 +783,7 @@ The conditions for allowing client caching are:
 page was cachedNo *_INT or *_EXT objects were on the page (eg. USER_INT)No frontend user is logged inNo backend user is logged in
 
 If these conditions are met, the headers sent are:
-Last-Modified [SYS_LASTCHANGED of page id]Expires [expire time of page cache]Etag [md5 of content]Cache-Control: max-age: [seconds til expiretime]Pragma: public
+Last-Modified [SYS_LASTCHANGED of page id]Expires [expire time of page cache]ETag [md5 of content]Cache-Control: max-age: [seconds til expiretime]Pragma: public
 
 In case caching is not allowed, these headers are sent to avoid client caching:
 Cache-Control: private