summaryrefslogtreecommitdiffstats
path: root/tests/lib/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-04-03 16:09:44 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-04-03 16:09:44 +0200
commita2efdb87223fcaf7ee20ebfe8df4fae645d95a3e (patch)
tree7b59c6f63e22cf70aadc59dd3e6ba22a8edbd8a9 /tests/lib/files
parent54783550e8736e0507be05fdc8711d8b30218d72 (diff)
parent76c63a576089edcd553244f02d8c3f6c28038fd2 (diff)
downloadnextcloud-server-a2efdb87223fcaf7ee20ebfe8df4fae645d95a3e.tar.gz
nextcloud-server-a2efdb87223fcaf7ee20ebfe8df4fae645d95a3e.zip
Merge pull request #7970 from owncloud/webdav-upload-hash
Fix uploading files containing a # in the path for webdav
Diffstat (limited to 'tests/lib/files')
-rw-r--r--tests/lib/files/storage/storage.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 6ec35dfbc92..38cd17ac8c9 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -310,7 +310,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'),
@@ -326,4 +326,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);
+ }
}