Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions apps/dav/lib/Connector/Sabre/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/features/files/renameFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/features/files/renameFolders.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down