[BUGFIX] Truncate long GIFBUILDER file names 75/51675/2
authorThoams Oliver Moll <tom@fullcircle.de>
Fri, 13 Jan 2017 14:05:50 +0000 (15:05 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 14 Feb 2017 15:40:37 +0000 (16:40 +0100)
GIFBUILDER generates file names from serialized data from
the GIFBUILDER setup (typoscript).
This can result in too long file names when the GIFBUILDER
is called with many parameters and on filesystems with
a max filename/path length.

The comment of the function fileName() states that the filename
should be shortened to 100 chars, but this doesn't happen.

This patch introduces a simple substring to enforce this limit.

Change-Id: Iaa17760bbf34fc6c01a9bc5ea8d1f8b6b242fecb
Resolves: #79301
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/51675
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php

index 6c6fd66..fc02734 100644 (file)
@@ -753,6 +753,9 @@ class GifBuilder extends GraphicalFunctions
         $filePrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
         $filePrefix = $basicFileFunctions->cleanFileName($filePrefix);
 
+        // shorten prefix to avoid overly long file names
+        $filePrefix = substr($filePrefix, 0, 100);
+
         return $this->tempPath . $pre . $filePrefix . '_' . GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
     }