diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 494d4d635213..4f393116cbe6 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -126,11 +126,22 @@ public function setName($name) { throw new \Sabre\DAV\Exception\Forbidden(); } + // verify path of the source + $this->verifyPath(); + list($parentPath,) = \Sabre\HTTP\URLUtil::splitPath($this->path); list(, $newName) = \Sabre\HTTP\URLUtil::splitPath($name); - // verify path of the target - $this->verifyPath(); + // verify path of target + if (\OC\Files\Filesystem::isForbiddenFileOrDir($parentPath . '/' . $newName)) { + throw new \Sabre\DAV\Exception\Forbidden(); + } + + try { + $this->fileView->verifyPath($parentPath, $newName); + } catch (\OCP\Files\InvalidPathException $ex) { + throw new InvalidPath($ex->getMessage()); + } $newPath = $parentPath . '/' . $newName; diff --git a/tests/integration/features/webdav-related-new-endpoint.feature b/tests/integration/features/webdav-related-new-endpoint.feature index 0bc682f4ca6f..f7cfedc6b579 100644 --- a/tests/integration/features/webdav-related-new-endpoint.feature +++ b/tests/integration/features/webdav-related-new-endpoint.feature @@ -78,7 +78,6 @@ Feature: webdav-related-new-endpoint When User "user0" moves file "/welcome.txt" to "/a\\a" Then the HTTP status code should be "400" - @skip @issue-28441 Scenario: rename a file into a banned filename Given using new dav path And user "user0" exists @@ -388,7 +387,6 @@ Feature: webdav-related-new-endpoint When User "user0" moves folder "/testshare" to "/hola%5Chola" Then the HTTP status code should be "400" - @skip @issue-28441 Scenario: Renaming a folder into a banned name Given using new dav path And user "user0" exists diff --git a/tests/ui/features/files/renameFiles.feature b/tests/ui/features/files/renameFiles.feature index 0822e8f66eb3..a80762f034be 100644 --- a/tests/ui/features/files/renameFiles.feature +++ b/tests/ui/features/files/renameFiles.feature @@ -43,7 +43,13 @@ Feature: renameFiles |Could not rename "data.zip"| And the file "data.zip" should be listed - @skip @issue-28441 + Scenario: Rename a file to a forbidden name + When I rename the file "data.zip" to one of these names + |.htaccess | + Then notifications should be displayed with the text + |Could not rename "data.zip"| + And the file "data.zip" should be listed + Scenario: Rename a file to a forbidden name When I rename the file "data.zip" to one of these names |.htaccess | diff --git a/tests/ui/features/files/renameFolders.feature b/tests/ui/features/files/renameFolders.feature index e4a4f62d23ae..bf20637af183 100644 --- a/tests/ui/features/files/renameFolders.feature +++ b/tests/ui/features/files/renameFolders.feature @@ -42,7 +42,13 @@ Feature: renameFolders |Could not rename "simple-folder"| And the folder "simple-folder" should be listed - @skip @issue-28441 + Scenario: Rename a folder to a forbidden name + When I rename the folder "simple-folder" to one of these names + |.htaccess | + Then notifications should be displayed with the text + |Could not rename "simple-folder"| + And the folder "simple-folder" should be listed + Scenario: Rename a folder to a forbidden name When I rename the folder "simple-folder" to one of these names |.htaccess |