diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2016-12-23 14:36:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-23 14:36:34 +0100 |
commit | 6f96af0fce24bf86b201b8ed5b27c2eff62099fc (patch) | |
tree | 32145ab5a203a649fb8aaa38128dd88ed9a2b82f /apps | |
parent | 886341aca4951d4b5d3ea846d09c45cd0858fb57 (diff) | |
parent | 34d466b2f6184a1bfd886e09a45056c76bc83ee6 (diff) | |
download | nextcloud-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.php | 10 |
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)) { |