From a90581b405d1aff8bbe3abbfeb9970798a9cce6e Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Thu, 11 May 2023 12:46:16 +0200 Subject: Get rid of more int casts in file size manipulations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/Files/Storage/DAV.php | 5 +++-- lib/private/Files/Storage/Local.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/private/Files/Storage') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index b332f3b7c4a..a791db651c3 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -51,6 +51,7 @@ use OCP\Files\StorageInvalidException; use OCP\Files\StorageNotAvailableException; use OCP\Http\Client\IClientService; use OCP\ICertificateManager; +use OCP\Util; use Psr\Http\Message\ResponseInterface; use Sabre\DAV\Client; use Sabre\DAV\Xml\Property\ResourceType; @@ -451,7 +452,7 @@ class DAV extends Common { return FileInfo::SPACE_UNKNOWN; } if (isset($response['{DAV:}quota-available-bytes'])) { - return (int)$response['{DAV:}quota-available-bytes']; + return Util::numericToNumber($response['{DAV:}quota-available-bytes']); } else { return FileInfo::SPACE_UNKNOWN; } @@ -605,7 +606,7 @@ class DAV extends Common { } return [ 'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : null, - 'size' => (int)($response['{DAV:}getcontentlength'] ?? 0), + 'size' => Util::numericToNumber($response['{DAV:}getcontentlength'] ?? 0), ]; } catch (\Exception $e) { $this->convertException($e, $path); diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index ee86fe356f7..3b292506578 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -52,6 +52,7 @@ use OCP\Files\GenericFileException; use OCP\Files\IMimeTypeDetector; use OCP\Files\Storage\IStorage; use OCP\IConfig; +use OCP\Util; use Psr\Log\LoggerInterface; /** @@ -422,7 +423,7 @@ class Local extends \OC\Files\Storage\Common { if ($space === false || is_null($space)) { return \OCP\Files\FileInfo::SPACE_UNKNOWN; } - return (int)$space; + return Util::numericToNumber($space); } public function search($query) { -- cgit v1.2.3