From 97b040298489e44416b45f6521c5ce0353d554ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 9 Nov 2020 16:26:09 +0100 Subject: [PATCH] Empty string is returned as null, but empty string in file cache is the root and exists Signed-off-by: Joas Schilling --- lib/private/Files/Cache/Cache.php | 6 +++++- lib/private/Share20/DefaultShareProvider.php | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index e74cc86d9c..1d3b4da3bc 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -998,7 +998,11 @@ class Cache implements ICache { $path = $result->fetchColumn(); $result->closeCursor(); - return $path === false ? null : $path; + if ($path === false) { + return null; + } + + return (string) $path; } /** diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index e43529086f..b4ac3b3b84 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -874,6 +874,11 @@ class DefaultShareProvider implements IShareProvider { $cursor = $qb->execute(); while ($data = $cursor->fetch()) { + if ($data['fileid'] && $data['path'] === null) { + $data['path'] = (string) $data['path']; + $data['name'] = (string) $data['name']; + $data['checksum'] = (string) $data['checksum']; + } if ($this->isAccessibleResult($data)) { $shares[] = $this->createShare($data); } @@ -1004,7 +1009,7 @@ class DefaultShareProvider implements IShareProvider { ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) ->setTarget($data['file_target']) - ->setNote($data['note']) + ->setNote((string)$data['note']) ->setMailSend((bool)$data['mail_send']) ->setStatus((int)$data['accepted']) ->setLabel($data['label']);