diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2013-06-20 13:52:35 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2013-06-20 13:52:35 (GMT) |
commit | aa67eb6fd91fe78373ef961b0207fe29fa9398a1 (patch) | |
tree | b87b6c387ea982671ed4ccad8bb386eecc91db9b /lib | |
parent | 84789326b63f7c976b7fd079cd301e8c6b0e4478 (diff) | |
download | iRony-aa67eb6fd91fe78373ef961b0207fe29fa9398a1.tar.gz |
Fix WebDAV service for Mac OS X Finder: add support for locking (otherwise mounted read-only); handle the numerous attempts to read and write hidden/temp files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kolab/DAV/Collection.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Kolab/DAV/Collection.php b/lib/Kolab/DAV/Collection.php index e391162..1a08d1d 100644 --- a/lib/Kolab/DAV/Collection.php +++ b/lib/Kolab/DAV/Collection.php @@ -95,6 +95,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection */ public function getChild($name) { + // no support for hidden system files + if ($name[0] == '.') { + throw new \Sabre\DAV\Exception\NotFound('File not found: ' . $name); + } + // @TODO: optimise this? foreach ($this->getChildren() as $child) { if ($child->getName() == $name) { @@ -150,6 +155,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection */ public function createFile($name, $data = null) { + // no support for hidden system files + if ($name[0] == '.') { + throw new \Sabre\DAV\Exception\Forbidden('Hidden files are not accepted'); + } + $filename = $this->path . '/' . $name; $filedata = $this->fileData($name, $data); @@ -173,6 +183,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection */ public function createDirectory($name) { + // no support for hidden system files + if ($name[0] == '.') { + throw new \Sabre\DAV\Exception\Forbidden('Hidden files are not accepted'); + } + $folder = $this->path . '/' . $name; try { @@ -185,4 +200,5 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection // reset cache $this->children = null; } + } |