[BUGFIX] Installer rejects traling slash in link target 29/27229/2
authorAndreas Wolf <andreas.wolf@typo3.org>
Sat, 1 Feb 2014 12:18:32 +0000 (13:18 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 23 Feb 2014 10:27:07 +0000 (11:27 +0100)
When having e.g. the link for ``typo3/`` pointing to
``typo3_src/typo3/``, the install tool complains because the trailing
slash is not expected. This slash is however perfectly ok, as there is
no difference between typo3_src/typo3 and typo3_src/typo3/ – both point
to the same "file" (i.e. node in the filesystem structure).

This patch strips trailing slashes from the actual link target before
doing the check, so no change to existing configuration is necessary.

Change-Id: Ibcb2118a2bb8fcf004470f1a949824576ad4d1ec
Resolves: #55551
Releases: 6.2
Reviewed-on: https://review.typo3.org/27229
Reviewed-by: Benjamin Mack
Reviewed-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/install/Classes/FolderStructure/LinkNode.php
typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php

index d865b73..b868bdb 100644 (file)
@@ -185,7 +185,7 @@ class LinkNode extends AbstractNode implements NodeInterface {
                        $result = TRUE;
                } else {
                        $actualTarget = $this->getCurrentTarget();
-                       if ($actualTarget === $expectedTarget) {
+                       if ($actualTarget === rtrim($expectedTarget, '/')) {
                                $result = TRUE;
                        }
                }
index 3fdf161..5b6fdc2 100644 (file)
@@ -336,6 +336,19 @@ class LinkNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
+       public function isTargetCorrectAcceptsATargetWithATrailingSlash() {
+               /** @var $node \TYPO3\CMS\Install\FolderStructure\LinkNode|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject */
+               $node = $this->getAccessibleMock('TYPO3\\CMS\\Install\\FolderStructure\\LinkNode', array('exists', 'isLink', 'getCurrentTarget', 'getTarget'), array(), '', FALSE);
+               $node->expects($this->any())->method('exists')->will($this->returnValue(TRUE));
+               $node->expects($this->any())->method('isLink')->will($this->returnValue(TRUE));
+               $node->expects($this->once())->method('getCurrentTarget')->will($this->returnValue('someLinkTarget'));
+               $node->expects($this->once())->method('getTarget')->will($this->returnValue('someLinkTarget/'));
+               $this->assertTrue($node->_call('isTargetCorrect'));
+       }
+
+       /**
+        * @test
+        */
        public function isTargetCorrectReturnsTrueIfActualTargetIsIdenticalToSpecifiedTarget() {
                if (TYPO3_OS === 'WIN') {
                        $this->markTestSkipped('Test not available on Windows OS.');