From d8961ed10f50b8c9fcb87e7ea68cb60768a9607f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 26 Aug 2022 15:59:29 +0200 Subject: fix using FSEEK_END with SeekableHttpStream to get file size Signed-off-by: Robin Appelman --- tests/lib/Files/Storage/Storage.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/lib/Files/Storage') diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index c4248b7e0da..a646fd5fd0b 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -664,4 +664,18 @@ abstract class Storage extends \Test\TestCase { $this->assertStringEqualsFile($textFile, $storage->file_get_contents('test.txt')); $this->assertEquals('resource (closed)', gettype($source)); } + + public function testFseekSize() { + $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; + $this->instance->file_put_contents('bar.txt', file_get_contents($textFile)); + + $size = $this->instance->filesize('bar.txt'); + $this->assertEquals(filesize($textFile), $size); + $fh = $this->instance->fopen('bar.txt', 'r'); + + fseek($fh, 0, SEEK_END); + $pos = ftell($fh); + + $this->assertEquals($size, $pos); + } } -- cgit v1.2.3