diff options
Diffstat (limited to 'lib/private/connector/sabre/node.php')
-rw-r--r-- | lib/private/connector/sabre/node.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index 8fee6a4eb4e..775e18657f1 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -103,9 +103,8 @@ abstract class Node implements \Sabre\DAV\INode { list($parentPath,) = \Sabre\HTTP\URLUtil::splitPath($this->path); list(, $newName) = \Sabre\HTTP\URLUtil::splitPath($name); - if (!\OCP\Util::isValidFileName($newName)) { - throw new \Sabre\DAV\Exception\BadRequest(); - } + // verify path of the target + $this->verifyPath(); $newPath = $parentPath . '/' . $newName; @@ -230,4 +229,13 @@ abstract class Node implements \Sabre\DAV\INode { } return $p; } + + protected function verifyPath() { + try { + $fileName = basename($this->info->getPath()); + $this->fileView->verifyPath($this->path, $fileName); + } catch (\OCP\Files\InvalidPathException $ex) { + throw new OC_Connector_Sabre_Exception_InvalidPath($ex->getMessage()); + } + } } |