Skip to content

[tests-only] test: add test to download multiple files from public link#12125

Open
kavitagautam wants to merge 1 commit intomasterfrom
test/public-link-multi-file-download
Open

[tests-only] test: add test to download multiple files from public link#12125
kavitagautam wants to merge 1 commit intomasterfrom
test/public-link-multi-file-download

Conversation

@kavitagautam
Copy link
Copy Markdown

@kavitagautam kavitagautam commented Mar 18, 2026

Description

This test verifies that a public user can successfully download a ZIP archive of files from a shared folder inside a space using a public link.

  • Sets up a space and folder structure with multiple uploaded files
  • Creates a public resource link share for the folder with a password
  • Fetches archive metadata via a PROPFIND request to the public WebDAV API
  • Uses the retrieved metadata to download the archive from the public link
  • Validates that the archive download request is successful with HTTP status 200

Related Issue

#12037

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@update-docs
Copy link
Copy Markdown

update-docs Bot commented Mar 18, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kavitagautam kavitagautam self-assigned this Mar 18, 2026
@kavitagautam kavitagautam marked this pull request as draft March 18, 2026 05:09
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch 3 times, most recently from b4b02c8 to aef2426 Compare April 8, 2026 12:31
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch 4 times, most recently from 6c19863 to b62c1b9 Compare April 16, 2026 17:30
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch 7 times, most recently from 605e089 to 495d9b8 Compare April 28, 2026 07:17
@kavitagautam kavitagautam marked this pull request as ready for review April 28, 2026 07:18
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch 2 times, most recently from 38ac902 to 467f3e8 Compare April 28, 2026 08:31
@saw-jan saw-jan changed the title feat: public link multifile download [tests-only] test: add test to download multiple files from public link Apr 28, 2026
Comment thread tests/acceptance/bootstrap/PublicWebDavContext.php Outdated
Comment thread tests/acceptance/bootstrap/PublicWebDavContext.php Outdated
Comment thread tests/acceptance/bootstrap/PublicWebDavContext.php Outdated
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch from 467f3e8 to 982296c Compare April 28, 2026 12:35
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch from 982296c to 9308c61 Compare April 29, 2026 07:05
Comment thread tests/acceptance/bootstrap/ArchiverContext.php Outdated
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch 2 times, most recently from 69ba83b to e712c9f Compare May 2, 2026 11:41
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
Comment thread tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature Outdated
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch from e712c9f to bc22a25 Compare May 4, 2026 09:52
Comment thread tests/acceptance/bootstrap/ArchiverContext.php Outdated
Signed-off-by: Kavita Gautam <kavita@jankaritech.com>

test: public link multifile download

Signed-off-by: Kavita Gautam <kavita@jankaritech.com>

Apply suggestions from code review

Co-authored-by: Sawjan Gurung <saw.jan.grg3e@gmail.com>
@kavitagautam kavitagautam force-pushed the test/public-link-multi-file-download branch from bc22a25 to 9bad443 Compare May 4, 2026 12:12
Comment on lines +57 to +60
| resource | project-folder |
| space | new-space |
| permissionsRole | <permissionsRole> |
| password | %public% |
Copy link
Copy Markdown
Member

@saw-jan saw-jan May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| resource | project-folder |
| space | new-space |
| permissionsRole | <permissionsRole> |
| password | %public% |
| resource | project-folder |
| space | new-space |
| permissionsRole | <permissionsRole> |
| password | %public% |

Comment on lines +279 to +317
$body = '<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:prop>
<d:resourcetype/>
<oc:public-link-item-type/>
<oc:public-link-permission/>
<oc:public-link-expiration/>
<oc:fileid/>
<oc:downloadURL/>
<oc:signature-auth/>
<oc:public-link-share-datetime/>
<oc:public-link-share-owner/>
</d:prop>
</d:propfind>';

$token = $this->featureContext->isUsingSharingNG()
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();

$password = $this->featureContext->getActualPassword($password);

$url = $this->featureContext->getBaseUrl() . "/dav/public-files/$token";

$headers = [
"Depth" => "1",
"OCS-APIRequest" => "true",
"public-token" => $token,
"Content-Type" => "application/xml; charset=utf-8",
"Authorization" => "Basic " . base64_encode("public:$password"),
];

$response = HttpRequestHelper::sendRequest(
$url,
"PROPFIND",
null,
null,
$headers,
$body,
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if this works

Suggested change
$body = '<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:prop>
<d:resourcetype/>
<oc:public-link-item-type/>
<oc:public-link-permission/>
<oc:public-link-expiration/>
<oc:fileid/>
<oc:downloadURL/>
<oc:signature-auth/>
<oc:public-link-share-datetime/>
<oc:public-link-share-owner/>
</d:prop>
</d:propfind>';
$token = $this->featureContext->isUsingSharingNG()
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
$password = $this->featureContext->getActualPassword($password);
$url = $this->featureContext->getBaseUrl() . "/dav/public-files/$token";
$headers = [
"Depth" => "1",
"OCS-APIRequest" => "true",
"public-token" => $token,
"Content-Type" => "application/xml; charset=utf-8",
"Authorization" => "Basic " . base64_encode("public:$password"),
];
$response = HttpRequestHelper::sendRequest(
$url,
"PROPFIND",
null,
null,
$headers,
$body,
);
$token = $this->featureContext->isUsingSharingNG()
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
: $this->featureContext->getLastCreatedPublicShareToken();
$password = $this->featureContext->getActualPassword($password);
$response = WebDavHelper::propfind(
$this->featureContext->getBaseUrl(),
"public",
"$password",
"$token",
['oc:fileid', 'oc:downloadURL', 'oc:signature-auth'],
null,
null,
"public-files",
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants