mirror of
https://github.com/nextcloud/server.git
synced 2026-04-24 23:59:27 -04:00
Merge pull request #2819 from nextcloud/trash-ext-link-uselinkowner
Fallback to share link owner when no owner found
This commit is contained in:
commit
6f96af0fce
1 changed files with 10 additions and 0 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue