@@ -115,7 +115,7 @@ public function onCreateCollection(RequestInterface $request, ResponseInterface
115115 $ destinationPath = $ this ->server ->calculateUri ($ request ->getUrl ());
116116 $ collectionPath = $ this ->getPathForDestination ($ destinationPath );
117117 } catch (\Exception $ e ) {
118- // Optionally log: error_log ('Quota check failed during onCreateCollection: ' . $e->getMessage());
118+ // Optionally log: e.g. ('Quota check failed during onCreateCollection: ' . $e->getMessage());
119119 return true ; // Quota cannot be checked, allow by default
120120 }
121121 if ($ collectionPath ) {
@@ -275,21 +275,21 @@ public function checkQuota(string $path, int|float|null $length = null, bool $is
275275 * returns null.
276276 *
277277 * @internal
278- * @return int|null The largest valid content length, or null if none is found.
278+ * @return int|float| null The largest valid content length, or null if none is found.
279279 */
280- public function getLength (): ? int {
280+ public function getLength (): int | float | null {
281281 $ request = $ this ->server ->httpRequest ;
282282
283283 // Get headers as strings
284284 $ expectedLength = $ request ->getHeader ('X-Expected-Entity-Length ' );
285285 $ contentLength = $ request ->getHeader ('Content-Length ' );
286286 $ ocTotalLength = $ request ->getHeader ('OC-Total-Length ' );
287287
288- // Filter out non-numeric values, cast to int
288+ // Filter out non-numeric values, use Util::numericToNumber for safe conversion
289289 $ lengths = array_filter ([
290- is_numeric ($ expectedLength ) ? ( int ) $ expectedLength : null ,
291- is_numeric ($ contentLength ) ? ( int ) $ contentLength : null ,
292- is_numeric ($ ocTotalLength ) ? ( int ) $ ocTotalLength : null ,
290+ is_numeric ($ expectedLength ) ? Util:: numericToNumber ( $ expectedLength) : null ,
291+ is_numeric ($ contentLength ) ? Util:: numericToNumber ( $ contentLength) : null ,
292+ is_numeric ($ ocTotalLength ) ? Util:: numericToNumber ( $ ocTotalLength) : null ,
293293 ], fn ($ v ) => $ v !== null );
294294
295295 // Return the largest valid length, or null if none
0 commit comments