summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-12-23 14:36:34 +0100
committerGitHub <noreply@github.com>2016-12-23 14:36:34 +0100
commit6f96af0fce24bf86b201b8ed5b27c2eff62099fc (patch)
tree32145ab5a203a649fb8aaa38128dd88ed9a2b82f /apps
parent886341aca4951d4b5d3ea846d09c45cd0858fb57 (diff)
parent34d466b2f6184a1bfd886e09a45056c76bc83ee6 (diff)
downloadnextcloud-server-6f96af0fce24bf86b201b8ed5b27c2eff62099fc.tar.gz
nextcloud-server-6f96af0fce24bf86b201b8ed5b27c2eff62099fc.zip
Merge pull request #2819 from nextcloud/trash-ext-link-uselinkowner
Fallback to share link owner when no owner found
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index e9376e8a3af..e73d6b0ac69 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -88,6 +88,10 @@ class Trashbin {
if (!$userManager->userExists($uid)) {
$uid = User::getUser();
}
+ if (!$uid) {
+ // no owner, usually because of share link from ext storage
+ return [null, null];
+ }
Filesystem::initMountPoints($uid);
if ($uid != User::getUser()) {
$info = Filesystem::getFileInfo($filename);
@@ -206,6 +210,12 @@ class Trashbin {
list(, $user) = explode('/', $root);
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
+ // if no owner found (ex: ext storage + share link), will use the current user's trashbin then
+ if (is_null($owner)) {
+ $owner = $user;
+ $ownerPath = $file_path;
+ }
+
$ownerView = new View('/' . $owner);
// file has been deleted in between
if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) {