content-range end should be 1 less than file size
This commit is contained in:
parent
62bdc77b93
commit
518b45827f
2 changed files with 4 additions and 4 deletions
|
@ -650,11 +650,11 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
$end = $request->getContentRangeEnd();
|
||||
$fileSize = $request->getContentRangeSize();
|
||||
$deploymentId = $request->getHeader('x-appwrite-id', $deploymentId);
|
||||
if (is_null($start) || is_null($end) || is_null($fileSize)) {
|
||||
if (is_null($start) || is_null($end) || is_null($fileSize) || $end >= $fileSize) {
|
||||
throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE);
|
||||
}
|
||||
|
||||
if ($end === $fileSize) {
|
||||
if ($end === $fileSize - 1) {
|
||||
//if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to notify it's last chunk
|
||||
$chunks = $chunk = -1;
|
||||
} else {
|
||||
|
|
|
@ -444,11 +444,11 @@ App::post('/v1/storage/buckets/:bucketId/files')
|
|||
$end = $request->getContentRangeEnd();
|
||||
$fileSize = $request->getContentRangeSize();
|
||||
$fileId = $request->getHeader('x-appwrite-id', $fileId);
|
||||
if (is_null($start) || is_null($end) || is_null($fileSize)) {
|
||||
if (is_null($start) || is_null($end) || is_null($fileSize) || $end >= $fileSize) {
|
||||
throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE);
|
||||
}
|
||||
|
||||
if ($end === $fileSize) {
|
||||
if ($end === $fileSize - 1) {
|
||||
//if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to -1 notify it's last chunk
|
||||
$chunks = $chunk = -1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue