Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-11-14 11:39:06 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-11-14 11:39:45 +0300
commit1ec9796a236dd3d3953700731062ef0d70425f72 (patch)
treee61a112de7110abf411e6d9cccff58854ded639a /apps
parentaefbe29971fc68ba1251466c97f5ea2306fcde44 (diff)
[stable9.1] Fallback to share link owner when no owner found (#26587)
When creating link shares from external storage, the filesystem cannot find an owner in some scenarios (ex: system-wide mounts). In such cases, fall back to using the current user's trashbin which happens to also be the user who created the link share. Fixes an issue where this scenario made deletion impossible due to missing user information.
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 6dfd71fd8c7..64aae584a28 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -87,6 +87,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);
@@ -203,6 +207,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)) {