diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-01-19 19:19:22 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-01-19 19:19:22 +0100 |
commit | afd1ddb0eab16a74d1bfad0af95e623abd8c486a (patch) | |
tree | 6230f26c60baa3f86ba4ee872b366343ffb45183 /apps/dav/lib/Connector/Sabre/FilesPlugin.php | |
parent | d42d8b79e0c83f57336b9c135711e33d9c9afa5f (diff) | |
download | nextcloud-server-afd1ddb0eab16a74d1bfad0af95e623abd8c486a.tar.gz nextcloud-server-afd1ddb0eab16a74d1bfad0af95e623abd8c486a.zip |
chore(dav): Make json_encode and json_decode throw on error
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/FilesPlugin.php')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FilesPlugin.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 54919824864..f53c62afba2 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -321,11 +321,11 @@ class FilesPlugin extends ServerPlugin { $user->getUID() ); $ocmPermissions = $this->ncPermissions2ocmPermissions($ncPermissions); - return json_encode($ocmPermissions); + return json_encode($ocmPermissions, JSON_THROW_ON_ERROR); }); $propFind->handle(self::SHARE_ATTRIBUTES_PROPERTYNAME, function () use ($node, $httpRequest) { - return json_encode($node->getShareAttributes()); + return json_encode($node->getShareAttributes(), JSON_THROW_ON_ERROR); }); $propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node): string { @@ -350,7 +350,7 @@ class FilesPlugin extends ServerPlugin { }); $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { - return json_encode($this->previewManager->isAvailable($node->getFileInfo())); + return json_encode($this->previewManager->isAvailable($node->getFileInfo()), JSON_THROW_ON_ERROR); }); $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node): ?int { return $node->getSize(); @@ -422,7 +422,7 @@ class FilesPlugin extends ServerPlugin { if ($this->config->getSystemValueBool('enable_file_metadata', true)) { $propFind->handle(self::FILE_METADATA_SIZE, function () use ($node) { if (!str_starts_with($node->getFileInfo()->getMimetype(), 'image')) { - return json_encode((object)[]); + return json_encode((object)[], JSON_THROW_ON_ERROR); } if ($node->hasMetadata('size')) { @@ -438,7 +438,7 @@ class FilesPlugin extends ServerPlugin { \OC::$server->get(LoggerInterface::class)->debug('Inefficient fetching of metadata'); } - return json_encode((object)$sizeMetadata->getMetadata()); + return json_encode((object)$sizeMetadata->getMetadata(), JSON_THROW_ON_ERROR); }); } } |