Tinebase Filesystem - make getChild case sensitive
authorPaul Mehrer <p.mehrer@metaways.de>
Tue, 6 Jun 2017 08:57:15 +0000 (10:57 +0200)
committerPaul Mehrer <p.mehrer@metaways.de>
Tue, 6 Jun 2017 09:49:11 +0000 (11:49 +0200)
and added test. It is possible to rename a folder just by case now:
/a/b/c/d
=>
/a/b/c/D
did fail before, works now

Change-Id: I85962aea9c070a21443be688ad8167ca323ad303
Reviewed-on: http://gerrit.tine20.com/customers/4826
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Paul Mehrer <p.mehrer@metaways.de>
Tested-by: Paul Mehrer <p.mehrer@metaways.de>
tests/tine20/Filemanager/ControllerTests.php
tine20/Tinebase/Tree/Node.php

index b25da72..be0c189 100644 (file)
@@ -124,4 +124,16 @@ class Filemanager_ControllerTests extends TestCase
             Tinebase_Core::set(Tinebase_Core::USER, $oldUser);
         }
     }
+
+    public function testRenameFolderCaseSensitive()
+    {
+        // check if personal folder exists
+        $personalFolderPath = $this->_getPersonalPath(Tinebase_Core::getUser());
+        $translation = Tinebase_Translation::getTranslation('Tinebase');
+        $personalFolderPath .= sprintf($translation->_("/%s's personal files"), Tinebase_Core::getUser()->accountFullName);
+        $fileManager = Filemanager_Controller_Node::getInstance();
+
+        $fileManager->createNodes($personalFolderPath . '/test', Tinebase_Model_Tree_FileObject::TYPE_FOLDER);
+        $fileManager->moveNodes(array($personalFolderPath . '/test'), array($personalFolderPath . '/Test'));
+    }
 }
index 21150f6..76712b2 100644 (file)
@@ -271,7 +271,7 @@ class Tinebase_Tree_Node extends Tinebase_Backend_Sql_Abstract
         ), Tinebase_Model_Filter_FilterGroup::CONDITION_AND, array('ignoreAcl' => true));
         $child = $this->search($searchFilter)->getFirstRecord();
         
-        if (!$child) {
+        if (!$child || $childName !== $child->name) {
             throw new Tinebase_Exception_NotFound('child: ' . $childName . ' not found!');
         }