6060use OCP \Files \Search \ISearchQuery ;
6161use OCP \Files \Storage \IStorage ;
6262use OCP \IDBConnection ;
63+ use OCP \Util ;
6364use Psr \Log \LoggerInterface ;
6465
6566/**
@@ -191,8 +192,8 @@ public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader
191192 $ data ['path ' ] = (string )$ data ['path ' ];
192193 $ data ['fileid ' ] = (int )$ data ['fileid ' ];
193194 $ data ['parent ' ] = (int )$ data ['parent ' ];
194- $ data ['size ' ] = 0 + $ data ['size ' ];
195- $ data ['unencrypted_size ' ] = 0 + ($ data ['unencrypted_size ' ] ?? 0 );
195+ $ data ['size ' ] = Util:: numericToNumber ( $ data ['size ' ]) ;
196+ $ data ['unencrypted_size ' ] = Util:: numericToNumber ($ data ['unencrypted_size ' ] ?? 0 );
196197 $ data ['mtime ' ] = (int )$ data ['mtime ' ];
197198 $ data ['storage_mtime ' ] = (int )$ data ['storage_mtime ' ];
198199 $ data ['encryptedVersion ' ] = (int )$ data ['encrypted ' ];
@@ -900,7 +901,7 @@ public function getIncompleteChildrenCount($fileId) {
900901 *
901902 * @param string $path
902903 * @param array|null|ICacheEntry $entry (optional) meta data of the folder
903- * @return int
904+ * @return int|float
904905 */
905906 public function calculateFolderSize ($ path , $ entry = null ) {
906907 return $ this ->calculateFolderSizeInner ($ path , $ entry );
@@ -913,7 +914,7 @@ public function calculateFolderSize($path, $entry = null) {
913914 * @param string $path
914915 * @param array|null|ICacheEntry $entry (optional) meta data of the folder
915916 * @param bool $ignoreUnknown don't mark the folder size as unknown if any of it's children are unknown
916- * @return int
917+ * @return int|float
917918 */
918919 protected function calculateFolderSizeInner (string $ path , $ entry = null , bool $ ignoreUnknown = false ) {
919920 $ totalSize = 0 ;
@@ -937,13 +938,13 @@ protected function calculateFolderSizeInner(string $path, $entry = null, bool $i
937938
938939 if ($ rows ) {
939940 $ sizes = array_map (function (array $ row ) {
940- return ( int ) $ row ['size ' ];
941+ return Util:: numericToNumber ( $ row ['size ' ]) ;
941942 }, $ rows );
942943 $ unencryptedOnlySizes = array_map (function (array $ row ) {
943- return ( int ) $ row ['unencrypted_size ' ];
944+ return Util:: numericToNumber ( $ row ['unencrypted_size ' ]) ;
944945 }, $ rows );
945946 $ unencryptedSizes = array_map (function (array $ row ) {
946- return ( int ) (($ row ['unencrypted_size ' ] > 0 ) ? $ row ['unencrypted_size ' ] : $ row ['size ' ]);
947+ return Util:: numericToNumber (($ row ['unencrypted_size ' ] > 0 ) ? $ row ['unencrypted_size ' ] : $ row ['size ' ]);
947948 }, $ rows );
948949
949950 $ sum = array_sum ($ sizes );
0 commit comments