From 76c63a576089edcd553244f02d8c3f6c28038fd2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 31 Mar 2014 17:00:32 +0200 Subject: Fix uploading files containing a # in the path for webdav --- tests/lib/files/storage/storage.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index f3bfba3feb8..e4d9e93ca97 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -299,7 +299,7 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertFalse($this->instance->file_exists('folder')); } - public function hashProvider(){ + public function hashProvider() { return array( array('Foobar', 'md5'), array('Foobar', 'sha1'), @@ -315,4 +315,23 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertEquals(hash($type, $data), $this->instance->hash($type, 'hash.txt')); $this->assertEquals(hash($type, $data, true), $this->instance->hash($type, 'hash.txt', true)); } + + public function testHashInFileName() { + $this->instance->file_put_contents('#test.txt', 'data'); + $this->assertEquals('data', $this->instance->file_get_contents('#test.txt')); + + $this->instance->mkdir('#foo'); + $this->instance->file_put_contents('#foo/test.txt', 'data'); + $this->assertEquals('data', $this->instance->file_get_contents('#foo/test.txt')); + + $dh = $this->instance->opendir('#foo'); + $content = array(); + while ($file = readdir($dh)) { + if ($file != '.' and $file != '..') { + $content[] = $file; + } + } + + $this->assertEquals(array('test.txt'), $content); + } } -- cgit v1.2.3