0012522: can't upload into other users container
authorCornelius Weiß <c.weiss@metaways.de>
Mon, 16 Jan 2017 16:36:20 +0000 (17:36 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 18 Jan 2017 12:29:14 +0000 (13:29 +0100)
Change-Id: Id2ad1ee9288a617eb7c7f13c1ef5904033a91d07
Reviewed-on: http://gerrit.tine20.com/customers/4098
Tested-by: sstamer <s.stamer@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Filemanager/js/NodeTreePanel.js

index c9a4000..99c2b1c 100644 (file)
@@ -419,24 +419,26 @@ Ext.extend(Tine.Filemanager.NodeTreePanel, Tine.widgets.container.TreePanel, {
     
     /**
      * convert filesystem path to treePath
-     * 
+     *
      * NOTE: only the first depth gets converted!
      *       fs pathes of not yet loaded tree nodes can't be converted!
-     * 
+     *
      * @param {String} containerPath
      * @return {String} tree path
      */
-    getTreePath: function(path) {
-        var treePath = '/' + this.getRootNode().id;
-        
-        if (path && path != '/') {
-            if (path == '/personal') {
-                treePath += '/otherUsers';
+    getTreePath: function(containerPath) {
+        var treePath = '/' + this.getRootNode().id + (containerPath !== '/' ? containerPath : '');
+
+        // replace personal with otherUsers if personal && ! personal/myaccountid
+        var matches = containerPath.match(/^\/personal\/{0,1}([^\/]*)\/{0,1}/i);
+        if (matches) {
+            if (matches[1] != Tine.Tinebase.registry.get('currentAccount').accountLoginName) {
+                treePath = treePath.replace('personal', 'otherUsers');
+            } else {
+                treePath = treePath.replace('personal/'  + Tine.Tinebase.registry.get('currentAccount').accountLoginName, 'personal');
             }
-            
-            treePath += String(path).replace('personal/'  + Tine.Tinebase.registry.get('currentAccount').accountLoginName, 'personal');
         }
-        
+
         return treePath;
     },