2023-01-02 17:26:54 +05:45
Feature: upload file
As a user
I want to be able to upload files
So that I can store and share files between multiple client systems
Background:
2024-11-29 09:39:21 +05:45
Given user " Alice " has been created with default attributes
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file and check download content
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2024-03-20 15:01:51 +05:45
When user " Alice " uploads file with content " uploaded content " to " <file-name> " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the content of file " <file-name> " for user " Alice " should be " uploaded content "
2023-01-02 17:26:54 +05:45
Examples:
2024-03-20 15:01:51 +05:45
| dav-path-version | file-name |
2023-07-12 12:42:32 +05:45
| old | /upload.txt |
| old | /नेपाली.txt |
| old | /strängé file.txt |
| old | /s,a,m,p,l,e.txt |
| old | /C++ file.cpp |
| old | /?fi=le&% #2 . txt |
| old | / # %ab ab?=ed |
| new | /upload.txt |
| new | /strängé file.txt |
| new | /नेपाली.txt |
| new | /s,a,m,p,l,e.txt |
| new | /C++ file.cpp |
| new | /?fi=le&% #2 . txt |
| new | / # %ab ab?=ed |
| spaces | /upload.txt |
| spaces | /strängé file.txt |
| spaces | /नेपाली.txt |
| spaces | /s,a,m,p,l,e.txt |
| spaces | /C++ file.cpp |
| spaces | /?fi=le&% #2 . txt |
| spaces | / # %ab ab?=ed |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file into a folder and check download content
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2024-03-20 15:01:51 +05:45
And user "Alice" has created folder " <folder-name> "
When user "Alice" uploads file with content "uploaded content" to " <folder-name> / <file-name> " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be "204"
And the content of file " <folder-name> / <file-name> " for user "Alice" should be "uploaded content"
2023-01-02 17:26:54 +05:45
Examples:
2024-03-20 15:01:51 +05:45
| dav-path-version | folder-name | file-name |
2023-07-12 12:42:32 +05:45
| old | /upload | abc.txt |
| old | /strängé folder | strängé file.txt |
| old | /C++ folder | C++ file.cpp |
| old | /नेपाली | नेपाली |
| old | /folder #2.txt | file #2.txt |
| old | /folder ?2.txt | file ?2.txt |
| old | /?fi=le&% #2 . txt | # %ab ab?=ed |
| new | /upload | abc.txt |
| new | /strängé folder (duplicate #2 &) | strängé file (duplicate #2 &) |
| new | /C++ folder | C++ file.cpp |
| new | /नेपाली | नेपाली |
| new | /folder #2.txt | file #2.txt |
| new | /folder ?2.txt | file ?2.txt |
| new | /?fi=le&% #2 . txt | # %ab ab?=ed |
| spaces | /upload | abc.txt |
| spaces | /strängé folder (duplicate #2 &) | strängé file (duplicate #2 &) |
| spaces | /C++ folder | C++ file.cpp |
| spaces | /नेपाली | नेपाली |
| spaces | /folder #2.txt | file #2.txt |
| spaces | /folder ?2.txt | file ?2.txt |
| spaces | /?fi=le&% #2 . txt | # %ab ab?=ed |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-06-05 17:18:44 +05:45
Scenario Outline: upload chunked file with TUS
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user "Alice" uploads file with content "uploaded content" in 3 chunks to "/myChunkedFile.txt" using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be "204"
And the content of file "/myChunkedFile.txt" for user "Alice" should be "uploaded content"
2023-01-02 17:26:54 +05:45
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-06-05 17:18:44 +05:45
Scenario Outline: upload 1 byte chunks with TUS
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " uploads file with content " 0123456789 " in 10 chunks to " /myChunkedFile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the content of file " /myChunkedFile.txt " for user " Alice " should be " 0123456789 "
2023-01-02 17:26:54 +05:45
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-06-05 17:18:44 +05:45
Scenario Outline: upload to overwriting a file
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
And user " Alice " has uploaded file with content " original content " to " textfile.txt "
When user " Alice " uploads file with content " overwritten content " to " textfile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the content of file " textfile.txt " for user " Alice " should be " overwritten content "
2023-01-02 17:26:54 +05:45
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file and no version is available
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " uploads file with content " uploaded content " to " /upload.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the version folder of file " /upload.txt " for user " Alice " should contain " 0 " elements
2023-01-02 17:26:54 +05:45
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file twice and versions are available
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " uploads file with content " uploaded content " to " /upload.txt " using the TUS protocol on the WebDAV API
And user " Alice " uploads file with content " re-uploaded content " to " /upload.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the version folder of file " /upload.txt " for user " Alice " should contain " 1 " element
2023-01-02 17:26:54 +05:45
And the content of file " /upload.txt " for user " Alice " should be " re-uploaded content "
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file in chunks with TUS and no version is available
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " uploads file with content " 0123456789 " in 10 chunks to " /myChunkedFile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the version folder of file " /myChunkedFile.txt " for user " Alice " should contain " 0 " elements
2023-01-02 17:26:54 +05:45
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
2024-11-07 14:12:16 +05:45
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a twice file in chunks with TUS and versions are available
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " uploads file with content " 0123456789 " in 10 chunks to " /myChunkedFile.txt " using the TUS protocol on the WebDAV API
And user " Alice " uploads file with content " 01234 " in 5 chunks to " /myChunkedFile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 204 "
And the version folder of file " /myChunkedFile.txt " for user " Alice " should contain " 1 " elements
2023-01-02 17:26:54 +05:45
And the content of file " /myChunkedFile.txt " for user " Alice " should be " 01234 "
Examples:
2023-07-12 12:42:32 +05:45
| dav-path-version |
| old |
| new |
| spaces |
2023-01-02 17:26:54 +05:45
2025-09-22 10:52:52 +02:00
2023-01-02 17:26:54 +05:45
Scenario Outline: upload a file with invalid-name
2023-07-12 12:42:32 +05:45
Given using <dav-path-version> DAV path
2023-01-02 17:26:54 +05:45
When user " Alice " creates a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 100 |
| Upload-Metadata | filename <metadata> |
| Tus-Resumable | 1.0.0 |
Then the HTTP status code should be " 412 "
And the following headers should not be set
| header |
| Location |
2024-03-20 15:01:51 +05:45
And as " Alice " file <file-name> should not exist
2023-01-02 17:26:54 +05:45
Examples:
2024-03-20 15:01:51 +05:45
| dav-path-version | file-name | metadata |
2023-07-12 12:42:32 +05:45
| old | " " | IA== |
| old | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= |
| old | "folder/file" | Zm9sZGVyL2ZpbGU= |
| old | "my\\file" | bXkMaWxl |
2024-07-09 14:10:50 +05:45
| old | ".." | Li4= |
2023-07-12 12:42:32 +05:45
| new | " " | IA== |
| new | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= |
| new | "folder/file" | Zm9sZGVyL2ZpbGU= |
| new | "my\\file" | bXkMaWxl |
2024-07-09 14:10:50 +05:45
| new | ".." | Li4= |
2023-07-12 12:42:32 +05:45
| spaces | " " | IA== |
| spaces | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= |
| spaces | "folder/file" | Zm9sZGVyL2ZpbGU= |
| spaces | "my\\file" | bXkMaWxl |
2024-07-09 14:10:50 +05:45
| spaces | ".." | Li4= |
2024-01-22 20:01:10 +05:45
2025-09-22 10:52:52 +02:00
2024-01-22 20:01:10 +05:45
Scenario Outline: upload a zero-byte file
Given using <dav-path-version> DAV path
When user " Alice " uploads file " filesForUpload/zerobyte.txt " to " textfile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 201 "
And the following headers should be set
| header | value |
| Access-Control-Expose-Headers | Tus-Resumable, Upload-Offset, Location |
And the content of file " textfile.txt " for user " Alice " should be ""
2024-01-22 20:01:10 +05:45
Examples:
| dav-path-version |
| old |
| new |
| spaces |
2025-09-22 10:52:52 +02:00
@issue-8003
2024-01-22 20:01:10 +05:45
Scenario Outline: replace a file with zero-byte file
Given using <dav-path-version> DAV path
And user " Alice " has uploaded file with content " This is TUS upload " to " textfile.txt "
When user " Alice " uploads file " filesForUpload/zerobyte.txt " to " textfile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 201 "
And the following headers should be set
| header | value |
| Access-Control-Expose-Headers | Tus-Resumable, Upload-Offset, Location |
And the content of file " textfile.txt " for user " Alice " should be ""
2024-01-22 20:01:10 +05:45
Examples:
| dav-path-version |
| old |
| new |
| spaces |
2025-09-22 10:52:52 +02:00
@issue-8003
2024-01-22 20:01:10 +05:45
Scenario Outline: replace a file inside a folder with zero-byte file
Given using <dav-path-version> DAV path
And user " Alice " has created folder " testFolder "
And user " Alice " has uploaded file with content " This is TUS upload " to " testFolder/textfile.txt "
When user " Alice " uploads file " filesForUpload/zerobyte.txt " to " testFolder/textfile.txt " using the TUS protocol on the WebDAV API
2025-02-11 17:01:57 +05:45
Then the HTTP status code should be " 201 "
And the following headers should be set
| header | value |
| Access-Control-Expose-Headers | Tus-Resumable, Upload-Offset, Location |
And the content of file " testFolder/textfile.txt " for user " Alice " should be ""
2024-01-22 20:01:10 +05:45
Examples:
| dav-path-version |
| old |
| new |
| spaces |
2024-10-03 11:39:38 +05:45
@issue-8804
Scenario Outline: multiple upload locations of the same file
Given using <dav-path-version> DAV path
And user " Alice " has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
# bG9yZW0udHh0 is the base64 encode of lorem.txt
| Upload-Metadata | filename bG9yZW0udHh0 |
And user " Alice " has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
# bG9yZW0udHh0 is the base64 encode of lorem.txt
| Upload-Metadata | filename bG9yZW0udHh0 |
When user " Alice " uploads content " lorem " with checksum " MD5 d2e16e6ef52a45b7468f1da56bba1953 " and offset " 0 " to the index " 1 " location of file " lorem.txt " using the TUS protocol
Then the HTTP status code should be " 204 "
And the content of file " lorem.txt " for user " Alice " should be " lorem "
When user " Alice " tries to upload content " epsum " with checksum " MD5 d6145e3d2ced88009796acae1dc7929f " and offset " 0 " to the index " 0 " location of file " lorem.txt " using the TUS protocol
Then the HTTP status code should be " 409 "
And the content of file " lorem.txt " for user " Alice " should be " lorem "
Examples:
| dav-path-version |
| old |
| new |
| spaces |