diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-19 17:01:34 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-19 20:20:45 +0200 |
commit | 0dbcbc4cae2eb669fc73f60a761855a907469111 (patch) | |
tree | cbfc22a5a42c080842da615add0df9c6b4456bec /tests/lib | |
parent | 7186975e35d03312f46b27d808a98f7bc6064078 (diff) | |
download | nextcloud-server-0dbcbc4cae2eb669fc73f60a761855a907469111.tar.gz nextcloud-server-0dbcbc4cae2eb669fc73f60a761855a907469111.zip |
When the scanner detects a file is changed clear checksum
Fixes #23782 and #23783
If the file scanner detects a changed file we clear the checksum while
we update the cache.
* Unit test added
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/view.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 3e88a5306f8..86413c61aa1 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -2424,4 +2424,24 @@ class View extends \Test\TestCase { $this->assertEquals($expected, $files); } + + public function testFilePutContentsClearsChecksum() { + $storage = new Temporary(array()); + $scanner = $storage->getScanner(); + $storage->file_put_contents('foo.txt', 'bar'); + \OC\Files\Filesystem::mount($storage, array(), '/test/'); + $scanner->scan(''); + + $view = new \OC\Files\View('/test/foo.txt'); + $view->putFileInfo('.', ['checksum' => '42']); + + $this->assertEquals('bar', $view->file_get_contents('')); + $fh = tmpfile(); + fwrite($fh, 'fooo'); + rewind($fh); + $view->file_put_contents('', $fh); + $this->assertEquals('fooo', $view->file_get_contents('')); + $data = $view->getFileInfo('.'); + $this->assertEquals('', $data->getChecksum()); + } } |