mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: use consistent end >= fileSize range clamping
This commit is contained in:
1 parent
3190013af7
commit
134efdc72b
1 file changed
+7
-7
@@ -1471,7 +1471,7 @@ class Appwrite extends Source
|
|||||||
// Get the file size
|
// Get the file size
|
||||||
$fileSize = $file->getSize();
|
$fileSize = $file->getSize();
|
||||||
|
|
||||||
if ($end > $fileSize) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1495,7 +1495,7 @@ class Appwrite extends Source
|
|||||||
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
|
|
||||||
if ($end > $fileSize) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1704,7 +1704,7 @@ class Appwrite extends Source
|
|||||||
$responseHeaders
|
$responseHeaders
|
||||||
);
|
);
|
||||||
|
|
||||||
// content-length header was missing, file is less than max buffer size.
|
// content-length header missing, file is less than max buffer size
|
||||||
if (!array_key_exists('content-length', $responseHeaders)) {
|
if (!array_key_exists('content-length', $responseHeaders)) {
|
||||||
$file = $this->call(
|
$file = $this->call(
|
||||||
'GET',
|
'GET',
|
||||||
@@ -1739,7 +1739,7 @@ class Appwrite extends Source
|
|||||||
|
|
||||||
$fileSize = $responseHeaders['content-length'];
|
$fileSize = $responseHeaders['content-length'];
|
||||||
|
|
||||||
if ($end > $fileSize - 1) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1776,7 +1776,7 @@ class Appwrite extends Source
|
|||||||
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
|
|
||||||
if ($end > $fileSize) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1957,7 +1957,7 @@ class Appwrite extends Source
|
|||||||
|
|
||||||
$fileSize = $responseHeaders['content-length'];
|
$fileSize = $responseHeaders['content-length'];
|
||||||
|
|
||||||
if ($end > $fileSize - 1) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1990,7 +1990,7 @@ class Appwrite extends Source
|
|||||||
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$start += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
$end += Transfer::STORAGE_MAX_CHUNK_SIZE;
|
||||||
|
|
||||||
if ($end > $fileSize) {
|
if ($end >= $fileSize) {
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user