]> source.dussan.org Git - nextcloud-server.git/commitdiff
return fixed path, skip shared files outside of 'files'
authorJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 7 Aug 2013 16:18:40 +0000 (18:18 +0200)
committerVictor Dubiniuk <victor.dubiniuk@gmail.com>
Thu, 19 Sep 2013 18:08:32 +0000 (21:08 +0300)
apps/files_sharing/lib/cache.php

index 6386f1d2c60a391ee7ae60b1629c31c488efc540..a4402464481876b0ba5f8dd7589ed25fcf537e83 100644 (file)
@@ -254,9 +254,12 @@ class Shared_Cache extends Cache {
                        $result = \OC_DB::executeAudited($sql, array_merge(array($pattern), $chunk));
                        
                        while ($row = $result->fetchRow()) {
-                               $row['mimetype'] = $this->getMimetype($row['mimetype']);
-                               $row['mimepart'] = $this->getMimetype($row['mimepart']);
-                               $files[] = $row;
+                               if (substr($row['path'], 0, 6)==='files/') {
+                                       $row['path'] = substr($row['path'],6); // remove 'files/' from path as it's relative to '/Shared'
+                                       $row['mimetype'] = $this->getMimetype($row['mimetype']);
+                                       $row['mimepart'] = $this->getMimetype($row['mimepart']);
+                                       $files[] = $row;
+                               } // else skip results out of the files folder
                        }
                }
                return $files;