Empty string is returned as null, but empty string in file cache is the root and exists

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-11-09 16:26:09 +01:00
parent b6ce689e25
commit 97b0402984
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 11 additions and 2 deletions

View File

@ -998,7 +998,11 @@ class Cache implements ICache {
$path = $result->fetchColumn(); $path = $result->fetchColumn();
$result->closeCursor(); $result->closeCursor();
return $path === false ? null : $path; if ($path === false) {
return null;
}
return (string) $path;
} }
/** /**

View File

@ -874,6 +874,11 @@ class DefaultShareProvider implements IShareProvider {
$cursor = $qb->execute(); $cursor = $qb->execute();
while ($data = $cursor->fetch()) { 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)) { if ($this->isAccessibleResult($data)) {
$shares[] = $this->createShare($data); $shares[] = $this->createShare($data);
} }
@ -1004,7 +1009,7 @@ class DefaultShareProvider implements IShareProvider {
->setShareType((int)$data['share_type']) ->setShareType((int)$data['share_type'])
->setPermissions((int)$data['permissions']) ->setPermissions((int)$data['permissions'])
->setTarget($data['file_target']) ->setTarget($data['file_target'])
->setNote($data['note']) ->setNote((string)$data['note'])
->setMailSend((bool)$data['mail_send']) ->setMailSend((bool)$data['mail_send'])
->setStatus((int)$data['accepted']) ->setStatus((int)$data['accepted'])
->setLabel($data['label']); ->setLabel($data['label']);