From c778032276808efdcc4dbdac94017419aaba57a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 24 Feb 2019 11:08:04 +0100 Subject: [PATCH] Properly handle null as ownerId if file system access is denied by access token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/View.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index f12e4609e0..10fbf00e73 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1381,8 +1381,12 @@ class View { if ($mount instanceof MoveableMount && $internalPath === '') { $data['permissions'] |= \OCP\Constants::PERMISSION_DELETE; } - - $owner = $this->getUserObjectForOwner($storage->getOwner($internalPath)); + $ownerId = $storage->getOwner($internalPath); + $owner = null; + if ($ownerId !== null) { + // ownerId might be null if files are accessed with an access token without file system access + $owner = $this->getUserObjectForOwner($ownerId); + } $info = new FileInfo($path, $storage, $internalPath, $data, $mount, $owner); if ($data and isset($data['fileid'])) {