From 3c78f78ea99423106ad3f99d46cd6e348557b3d7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 9 Feb 2026 02:54:40 +0000 Subject: [PATCH] Fix: chunk upload handling for single chunk uploads --- .../Platform/Modules/Storage/Http/Buckets/Files/Create.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 4757461a98..a60fb983a7 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -256,6 +256,12 @@ class Create extends Action if ($uploaded === $chunks) { throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); } + } else { + // Guard against manually setting range header for single chunk upload + if ($chunks === -1) { + $chunks = 1; + $chunk = 1; + } } $chunksUploaded = $deviceForFiles->upload($fileTmpName, $path, $chunk, $chunks, $metadata);