mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: address CodeRabbit review - strict comparison and test assertions
Use strict !== in View/Get.php for consistency with Download/Get.php. Add accept-ranges and content-length assertions for single-byte probe and large-file download tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ba5f1fd2ee
commit
481cc19afe
@@ -144,7 +144,7 @@ class Get extends Action
|
||||
$end = min(($start + APP_STORAGE_READ_BUFFER - 1), ($size - 1));
|
||||
}
|
||||
|
||||
if ($unit != 'bytes' || $start > $end || $end >= $size) {
|
||||
if ($unit !== 'bytes' || $start > $end || $end >= $size) {
|
||||
throw new Exception(Exception::STORAGE_INVALID_RANGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -780,6 +780,7 @@ trait StorageBase
|
||||
|
||||
$this->assertEquals(206, $file51a['headers']['status-code']);
|
||||
$this->assertEquals('1', $file51a['headers']['content-length']);
|
||||
$this->assertEquals('bytes', $file51a['headers']['accept-ranges']);
|
||||
|
||||
// Test ranged download - with invalid range
|
||||
$file52 = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $data['fileId'] . '/download', array_merge([
|
||||
@@ -863,6 +864,8 @@ trait StorageBase
|
||||
$this->assertEquals(200, $file7['headers']['status-code']);
|
||||
$this->assertEquals('attachment; filename="large-file.mp4"', $file7['headers']['content-disposition']);
|
||||
$this->assertEquals('video/mp4', $file7['headers']['content-type']);
|
||||
$this->assertEquals('bytes', $file7['headers']['accept-ranges']);
|
||||
$this->assertNotEmpty($file7['headers']['content-length']);
|
||||
$this->assertNotEmpty($fileData);
|
||||
$this->assertEquals(md5_file(realpath(__DIR__ . '/../../../resources/disk-a/large-file.mp4')), md5($fileData)); // validate the file is downloaded correctly
|
||||
|
||||
|
||||
Reference in New Issue
Block a user