Skip to content

Commit

Permalink
Merge pull request #36116 from owncloud/checkHeaderEtag
Browse files Browse the repository at this point in the history
check Etag in header of file-operation responses
  • Loading branch information
individual-it committed Aug 30, 2019
2 parents 4aa17f5 + 53c45a9 commit c9f1d87
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Feature: sharing
| permissions | create |
When the public uploads file "test.txt" with content "test" using the old public WebDAV API
And the public uploads file "test.txt" with content "test2" with autorename mode using the old public WebDAV API
Then the content of file "/FOLDER/test.txt" for user "user0" should be "test"
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And the content of file "/FOLDER/test.txt" for user "user0" should be "test"
And the content of file "/FOLDER/test (2).txt" for user "user0" should be "test2"

@smokeTest @public_link_share-feature-required
Expand All @@ -26,6 +29,8 @@ Feature: sharing
When the public uploads file "test.txt" with content "test" using the new public WebDAV API
When the public uploads file "test.txt" with content "test2" using the new public WebDAV API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And the content of file "/FOLDER/test.txt" for user "user0" should be "test"
And the content of file "/FOLDER/test (2).txt" for user "user0" should be "test2"

Expand Down Expand Up @@ -102,8 +107,12 @@ Feature: sharing
| permissions | create |
When the public uploads file "test-old.txt" with content "test-old" using the old public WebDAV API
Then the content of file "/FOLDER/test-old.txt" for user "user0" should be "test-old"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
When the public uploads file "test-new.txt" with content "test-new" using the new public WebDAV API
Then the content of file "/FOLDER/test-new.txt" for user "user0" should be "test-new"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |

@public_link_share-feature-required
Scenario: Uploading to a public upload-only share with password
Expand All @@ -127,6 +136,8 @@ Feature: sharing
| shareWith | user1 |
When user "user1" uploads file "filesForUpload/textfile.txt" to "FOLDER (2)/textfile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
Examples:
| dav-path |
| old |
Expand All @@ -144,6 +155,8 @@ Feature: sharing
| shareWith | grp1 |
When user "user1" uploads file "filesForUpload/textfile.txt" to "FOLDER (2)/textfile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
Examples:
| dav-path |
| old |
Expand Down Expand Up @@ -203,6 +216,8 @@ Feature: sharing
And user "user0" has shared file "myfile.txt" with user "user1"
When user "user1" uploads file "filesForUpload/textfile.txt" to "/myfile.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
Examples:
| dav-path |
| old |
Expand Down Expand Up @@ -366,6 +381,8 @@ Feature: sharing
| permissions | uploadwriteonly |
When the public uploads file "test.txt" with content "test" using the <public-webdav-api-version> public WebDAV API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
When the public uploads file "test.txt" with content "test2" using the <public-webdav-api-version> public WebDAV API
Then the HTTP status code should be "403"
And the content of file "/FOLDER/test.txt" for user "user0" should be "test"
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/features/apiTrashbin/trashbinRestore.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Feature: Restore deleted files/folders
And user "user1" has deleted file "/renamed_shared/shared_file.txt"
When user "user1" restores the file with original path "/renamed_shared/shared_file.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user1" the file with original path "/renamed_shared/shared_file.txt" should not exist in trash
And user "user1" should see the following elements
| /renamed_shared/ |
Expand All @@ -38,6 +40,8 @@ Feature: Restore deleted files/folders
And as "user0" file "/textfile0.txt" should exist in trash
When user "user0" restores the folder with original path "/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user0" the folder with original path "/textfile0.txt" should not exist in trash
And user "user0" should see the following elements
| /FOLDER/ |
Expand Down Expand Up @@ -91,6 +95,8 @@ Feature: Restore deleted files/folders
And user "user0" has deleted file "<delete-path>"
When user "user0" restores the file with original path "<delete-path>" to "<restore-path>" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user0" the file with original path "<delete-path>" should not exist in trash
And as "user0" file "<restore-path>" should exist
And as "user0" file "<delete-path>" should not exist
Expand Down Expand Up @@ -189,6 +195,8 @@ Feature: Restore deleted files/folders
When user "user0" creates folder "/new-folder" using the WebDAV API
And user "user0" restores the file with original path "/new-folder/new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user0" the file with original path "/new-folder/new-file.txt" should not exist in trash
And as "user0" file "/new-folder/new-file.txt" should exist
Examples:
Expand All @@ -209,6 +217,8 @@ Feature: Restore deleted files/folders
And as "user0" the folder with original path "/local_storage/tmp/textfile0.txt" should exist in trash
When user "user0" restores the folder with original path "/local_storage/tmp/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user0" the folder with original path "/local_storage/tmp/textfile0.txt" should not exist in trash
And user "user0" should see the following elements
| /local_storage/ |
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/features/apiWebdavMove/moveFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Feature: move (rename) file
Given using <dav_version> DAV path
When user "user0" moves file "/welcome.txt" to "/FOLDER/welcome.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And the downloaded content when downloading file "/FOLDER/welcome.txt" for user "user0" with range "bytes=0-6" should be "Welcome"
Examples:
| dav_version |
Expand All @@ -24,6 +26,8 @@ Feature: move (rename) file
Given using <dav_version> DAV path
When user "user0" moves file "/welcome.txt" to "/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And the downloaded content when downloading file "/textfile0.txt" for user "user0" with range "bytes=0-6" should be "Welcome"
Examples:
| dav_version |
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/apiWebdavUpload/uploadFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Feature: upload file
Scenario Outline: upload a file and check download content
Given using <dav_version> DAV path
When user "user0" uploads file with content "uploaded content" to "<file_name>" using the WebDAV API
Then the content of file "<file_name>" for user "user0" should be "uploaded content"
Then the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And the content of file "<file_name>" for user "user0" should be "uploaded content"
Examples:
| dav_version | file_name |
| old | /upload.txt |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ Feature: upload file using new chunking
| 1 | AAAAA |
| 2 | BBBBB |
| 3 | CCCCC |
Then as "user0" file "/myChunkedFile.txt" should exist
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
| ETag | /^"[a-f0-9]{1,32}"$/ |
And as "user0" file "/myChunkedFile.txt" should exist
And the content of file "/myChunkedFile.txt" for user "user0" should be "AAAAABBBBBCCCCC"
And the log file should not contain any log-entries containing these attributes:
| app |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ Feature: upload file using old chunking
And the owncloud log level has been set to debug
And the owncloud log has been cleared

@issue-36115
Scenario: Upload chunked file asc
When user "user0" uploads the following "3" chunks to "/myChunkedFile.txt" with old chunking and using the WebDAV API
| 1 | AAAAA |
| 2 | BBBBB |
| 3 | CCCCC |
Then the HTTP status code should be "201"
And the following headers should match these regular expressions
#| ETag | /^"[a-f0-9]{1,32}"$/ |
| ETag | /^[a-f0-9]{1,32}$/ |
Then as "user0" file "/myChunkedFile.txt" should exist
And the content of file "/myChunkedFile.txt" for user "user0" should be "AAAAABBBBBCCCCC"

Expand Down

0 comments on commit c9f1d87

Please sign in to comment.