diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-03-31 17:00:32 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-03-31 17:00:32 +0200 |
commit | 76c63a576089edcd553244f02d8c3f6c28038fd2 (patch) | |
tree | ed0073d5e7b25db527c8992008875ba928094093 /tests | |
parent | 65e3f634000a2142f412b85d0443f241bb64a9ab (diff) | |
download | nextcloud-server-76c63a576089edcd553244f02d8c3f6c28038fd2.tar.gz nextcloud-server-76c63a576089edcd553244f02d8c3f6c28038fd2.zip |
Fix uploading files containing a # in the path for webdav
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/storage.php | 21 |
1 files changed, 20 insertions, 1 deletions
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); + } } |