Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-12-02 13:05:46 +0300
committerJoas Schilling <coding@schilljs.com>2016-12-02 13:14:47 +0300
commit5a7dfcacc546141cea75bcb13d05af374b3f8723 (patch)
treed6af78797b674a117798570ff3c70445a3bb71a0 /tests
parent72eb5d14e96c52f0698f4785025bf5520846aed9 (diff)
Make sure we don't scan files that can not be accessed
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/scanner.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index b1eb3f589e8..5ed1135d468 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -69,6 +69,22 @@ class Scanner extends \Test\TestCase {
$this->assertEquals($cachedData['mimetype'], 'image/png');
}
+ function testFile4Byte() {
+ $data = "dummy file data\n";
+ $this->storage->file_put_contents('foo🙈.txt', $data);
+
+ $this->assertNull($this->scanner->scanFile('foo🙈.txt'));
+ $this->assertFalse($this->cache->inCache('foo🙈.txt'), true);
+ }
+
+ function testFileInvalidChars() {
+ $data = "dummy file data\n";
+ $this->storage->file_put_contents("foo\nbar.txt", $data);
+
+ $this->assertNull($this->scanner->scanFile("foo\nbar.txt"));
+ $this->assertFalse($this->cache->inCache("foo\nbar.txt"), true);
+ }
+
private function fillTestFolders() {
$textData = "dummy file data\n";
$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');