Follow-up to #14845: No preview images with referenced files anymore (thanks to Stefa...
authorSusanne Moog <typo3@susannemoog.de>
Wed, 7 Jul 2010 16:56:57 +0000 (16:56 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Wed, 7 Jul 2010 16:56:57 +0000 (16:56 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8128 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_div.php
tests/t3lib/t3lib_divTest.php

index 94421f2..a33f86e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-07  Susanne Moog  <typo3@susanne-moog.de>
+
+       * Follow-up to #14845: No preview images with referenced files anymore (thanks to Stefan Galinski)
+
 2010-07-06  Susanne Moog  <typo3@susanne-moog.de>
 
        * Fixed bug #14845: Bug: Filelist module reports "type" of files also for directories  (thanks to Caspar Stuebs and Andy Grunwald)
index 27a1304..381926a 100644 (file)
@@ -1143,7 +1143,7 @@ final class t3lib_div {
                }
 
                $reg = '';
-               if (is_file($fileref) && preg_match('/(.*)\.([^\.]*$)/', $info['file'], $reg)) {
+               if (!is_dir($fileref) && preg_match('/(.*)\.([^\.]*$)/', $info['file'], $reg)) {
                        $info['filebody'] = $reg[1];
                        $info['fileext'] = strtolower($reg[2]);
                        $info['realFileext'] = $reg[2];
index 0635a20..602e88d 100644 (file)
@@ -1523,7 +1523,7 @@ class t3lib_divTest extends tx_phpunit_testcase {
         * @see t3lib_div::split_fileref()
         */
        public function checkIfSplitFileRefReturnsFileTypeNotForFolders(){
-               $directoryName = uniqid('test_');
+               $directoryName = uniqid('test_') . '.com';
                $directoryPath = PATH_site . 'typo3temp/';
                $directory = $directoryPath . $directoryName;
                mkdir($directory, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']));
@@ -1542,5 +1542,20 @@ class t3lib_divTest extends tx_phpunit_testcase {
 
                rmdir($directory);
        }
+
+       /**
+        * @test
+        * @see t3lib_div::split_fileref()
+        */
+       public function checkIfSplitFileRefReturnsFileTypeForFilesWithoutPathSite() {
+               $testFile = 'fileadmin/media/someFile.png';
+
+               $fileInfo = t3lib_div::split_fileref($testFile);
+               $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fileInfo);
+               $this->assertEquals('fileadmin/media/', $fileInfo['path']);
+               $this->assertEquals('someFile.png', $fileInfo['file']);
+               $this->assertEquals('someFile', $fileInfo['filebody']);
+               $this->assertEquals('png', $fileInfo['fileext']);
+       }
 }
 ?>
\ No newline at end of file