Skip to content
Open
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
2 changes: 1 addition & 1 deletion apps/dav/lib/TrashBin/AbstractTrashBinNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getOriginalLocation() : string {
$originalPath = $location . '/' . $originalPath;
}

return $originalPath;
return ltrim($originalPath, '/');
}

public function getDeleteTimestamp() : int {
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/41649
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: normalise trashbin original-location PROPFIND response

In certain situations the trashbin original-location in a PROPFIND response
contained a leading slash. This change ensures that a relative path (without
a leading slash) is always returned.

https://github.com/owncloud/core/issues/39337
https://github.com/owncloud/core/pull/41649
60 changes: 30 additions & 30 deletions tests/acceptance/features/apiTrashbin/trashbinDelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted file "/PARENT/CHILD/child.txt"
When user "Alice" deletes the file with original path "textfile1.txt" from the trashbin using the trashbin API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/textfile1.txt" should not exist in the trashbin
But as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile1.txt" should not exist in the trashbin
But as "Alice" the file with original path "textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -60,10 +60,10 @@ Feature: files and folders can be deleted from the trashbin
When user "Alice" deletes the file with original path "/PARENT/textfile0.txt" from the trashbin using the trashbin API
And user "Alice" deletes the file with original path "/PARENT/CHILD/child.txt" from the trashbin using the trashbin API
Then the HTTP status code of responses on all endpoints should be "204"
And as "Alice" the file with original path "/PARENT/textfile0.txt" should not exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should not exist in the trashbin
But as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/child.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/textfile0.txt" should not exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should not exist in the trashbin
But as "Alice" the file with original path "textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -78,10 +78,10 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted file "/PARENT/CHILD/child.txt"
When user "Brian" tries to delete the file with original path "textfile1.txt" from the trashbin of user "Alice" using the trashbin API
Then the HTTP status code should be "<status-code>"
And as "Alice" the file with original path "/textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path | status-code |
| new | 401 |
Expand All @@ -96,10 +96,10 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted file "/PARENT/CHILD/child.txt"
When user "Brian" tries to delete the file with original path "textfile1.txt" from the trashbin of user "Alice" using the password "invalid" and the trashbin API
Then the HTTP status code should be "401"
And as "Alice" the file with original path "/textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -114,10 +114,10 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted file "/PARENT/CHILD/child.txt"
When user "Brian" tries to delete the file with original path "textfile1.txt" from the trashbin of user "Alice" using the password "" and the trashbin API
Then the HTTP status code should be "401"
And as "Alice" the file with original path "/textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile1.txt" should exist in the trashbin
And as "Alice" the file with original path "textfile0.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -133,11 +133,11 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted folder "/FOLDER"
When user "Alice" deletes the folder with original path "/PARENT" from the trashbin using the trashbin API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/PARENT/parent.txt" should not exist in the trashbin
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should not exist in the trashbin
And as "Alice" the folder with original path "/PARENT/CHILD/" should not exist in the trashbin
But as "Alice" the file with original path "/FOLDER/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/FOLDER/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/parent.txt" should not exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should not exist in the trashbin
And as "Alice" the folder with original path "PARENT/CHILD/" should not exist in the trashbin
But as "Alice" the file with original path "FOLDER/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "FOLDER/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -153,11 +153,11 @@ Feature: files and folders can be deleted from the trashbin
And user "Alice" has deleted folder "/FOLDER"
When user "Alice" deletes the folder with original path "/PARENT/CHILD" from the trashbin using the trashbin API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/PARENT/CHILD/child.txt" should not exist in the trashbin
And as "Alice" the folder with original path "/PARENT/CHILD/" should not exist in the trashbin
But as "Alice" the file with original path "/PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/FOLDER/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "/FOLDER/CHILD/child.txt" should exist in the trashbin
And as "Alice" the file with original path "PARENT/CHILD/child.txt" should not exist in the trashbin
And as "Alice" the folder with original path "PARENT/CHILD/" should not exist in the trashbin
But as "Alice" the file with original path "PARENT/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "FOLDER/parent.txt" should exist in the trashbin
And as "Alice" the file with original path "FOLDER/CHILD/child.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand Down
40 changes: 20 additions & 20 deletions tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: files and folders exist in the trashbin after being deleted
Given using <dav-path> DAV path
When user "Alice" deletes file "/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" file "/textfile0.txt" should exist in the trashbin
And as "Alice" file "textfile0.txt" should exist in the trashbin
But as "Alice" file "/textfile0.txt" should not exist
Examples:
| dav-path |
Expand All @@ -25,7 +25,7 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has created folder "/tmp"
When user "Alice" deletes folder "/tmp" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "/tmp" should exist in the trashbin
And as "Alice" folder "tmp" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -37,8 +37,8 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/new-file.txt"
When user "Alice" deletes file "/new-folder/new-file.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/new-folder/new-file.txt" should exist in the trashbin
And as "Alice" file "/new-file.txt" should exist in the trashbin
And as "Alice" the file with original path "new-folder/new-file.txt" should exist in the trashbin
And as "Alice" file "new-file.txt" should exist in the trashbin
But as "Alice" file "/new-folder/new-file.txt" should not exist
Examples:
| dav-path |
Expand All @@ -53,8 +53,8 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has shared folder "/shared" with user "Brian"
When user "Alice" deletes file "/shared/shared_file.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/shared/shared_file.txt" should exist in the trashbin
And as "Alice" file "/shared_file.txt" should exist in the trashbin
And as "Alice" the file with original path "shared/shared_file.txt" should exist in the trashbin
And as "Alice" file "shared_file.txt" should exist in the trashbin
But as "Alice" file "/shared/shared_file.txt" should not exist
Examples:
| dav-path |
Expand All @@ -69,7 +69,7 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has shared folder "/shared" with user "Brian"
When user "Alice" deletes folder "/shared" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" the folder with original path "/shared" should exist in the trashbin
And as "Alice" the folder with original path "shared" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -96,11 +96,11 @@ Feature: files and folders exist in the trashbin after being deleted
| /folderC/textfile0.txt |
| /folderD/textfile0.txt |
Then the HTTP status code of responses on all endpoints should be "204"
And as "Alice" the folder with original path "/folderA/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/folderB/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/folderC/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/folderD/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderA/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderB/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderC/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderD/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "textfile0.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -116,9 +116,9 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" deletes file "/folderB/textfile0.txt" using the WebDAV API
And user "Alice" deletes file "/textfile0.txt" using the WebDAV API
Then the HTTP status code of responses on all endpoints should be "204"
And as "Alice" the folder with original path "/folderA/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/folderB/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderA/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "folderB/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "textfile0.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand All @@ -131,7 +131,7 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has moved file "/textfile0.txt" to "/local_storage/tmp/textfile0.txt"
When user "Alice" deletes folder "/local_storage/tmp" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" the folder with original path "/local_storage/tmp" should exist in the trashbin
And as "Alice" the folder with original path "local_storage/tmp" should exist in the trashbin
Examples:
| dav-path |
| new |
Expand Down Expand Up @@ -250,7 +250,7 @@ Feature: files and folders exist in the trashbin after being deleted
And user "<username>" has uploaded file with content "to delete" to "/textfile0.txt"
When user "<username>" deletes file "/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "<username>" file "/textfile0.txt" should exist in the trashbin
And as "<username>" file "textfile0.txt" should exist in the trashbin
But as "<username>" file "/textfile0.txt" should not exist
Examples:
| dav-path | username |
Expand Down Expand Up @@ -280,9 +280,9 @@ Feature: files and folders exist in the trashbin after being deleted
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/new-folder/new-file.txt"
When user "Alice" deletes folder "/new-folder" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" the file with original path "/new-folder/new-file.txt" should exist in the trashbin
And as "Alice" the folder with original path "/new-folder" should exist in the trashbin
And as "Alice" file "/new-folder/new-file.txt" should exist in the trashbin
And as "Alice" the file with original path "new-folder/new-file.txt" should exist in the trashbin
And as "Alice" the folder with original path "new-folder" should exist in the trashbin
And as "Alice" file "new-folder/new-file.txt" should exist in the trashbin
But as "Alice" file "/new-folder/new-file.txt" should not exist
Examples:
| dav-path |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Feature: files and folders exist in the trashbin after being deleted
# And as "Alice" the folder with original path "/folderB/textfile0.txt" should not exist in the trashbin
# And as "Alice" the folder with original path "/folderC/textfile0.txt" should not exist in the trashbin
# And as "Alice" the folder with original path "/folderD/textfile0.txt" should not exist in the trashbin
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And as "Alice" the folder with original path "textfile0.txt" should exist in the trashbin
Examples:
| dav-path |
| new |
Loading