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
9 changes: 9 additions & 0 deletions build/integration/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public function creatingShare(?TableNode $body): void {
$this->asCreatingAShareWith($this->currentUser, $body);
}

/**
* @When /^accepting last share via the accept endpoint$/
*/
public function acceptingLastShareViaAcceptEndpoint(): void {
$share_id = $this->lastShareData->data[0]->id;
$url = "/index.php/apps/files_sharing/accept/ocinternal:$share_id";
$this->sendingToDirectUrl('GET', $url);
}

/**
* @When /^accepting last share$/
*/
Expand Down
62 changes: 62 additions & 0 deletions build/integration/sharing_features/sharing-accept.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
Feature: sharing-accept
Background:
Given using api version "1"
Given using old dav path

Scenario: Accepting a non-existent share
Given user "user0" exists
And As an "user0"
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/ocinternal:999999"
Then the HTTP status code should be "404"

Scenario: Accepting a share with an invalid share ID
Given user "user0" exists
And As an "user0"
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/invalid:format"
Then the HTTP status code should be "404"

Scenario: Accepting a valid share
Given user "user0" exists
And user "user1" exists
And As an "user0"
When creating a share with
| path | welcome.txt |
| shareWith | user1 |
| shareType | 0 |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And As an "user1"
When accepting last share via the accept endpoint
Then the HTTP status code should be "200"

Scenario: Accepting a share as a different user
Given user "user0" exists
And user "user1" exists
And user "user2" exists
And As an "user0"
When creating a share with
| path | welcome.txt |
| shareWith | user1 |
| shareType | 0 |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And As an "user2"
When accepting last share via the accept endpoint
Then the HTTP status code should be "404"

Scenario: Accepting a share that is not a user share
Given user "user0" exists
And user "user1" exists
And user "user2" exists
And As an "user0"
When creating a share with
| path | drop |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you'll need to create the "drop" folder first.

[84](https://github.com/nextcloud/server/actions/runs/24344380989/job/71253275054?pr=59601#step:11:185)
  Scenario: Accepting a share that is not a user share # /home/runner/actions-runner/_work/server/server/build/integration/sharing_features/sharing-accept.feature:49
[3592] [Tue Apr 14 11:15:26 2026] [::1]:35278 [404]: GET /ocs/v2.php/cloud/users/user0
[3586] [Tue Apr 14 11:15:26 2026] [::1]:37928 [200]: POST /ocs/v1.php/cloud/users
[3591] [Tue Apr 14 11:15:27 2026] [::1]:37936 [200]: GET /ocs/v1.php/cloud/users/user0
    Given user "user0" exists                          # SharingContext::assureUserExists()
[3592] [Tue Apr 14 11:15:27 2026] [::1]:37948 [200]: GET /ocs/v2.php/cloud/users/user0
[3586] [Tue Apr 14 11:15:27 2026] [::1]:37952 [404]: GET /ocs/v2.php/cloud/users/user1
[3591] [Tue Apr 14 11:15:28 2026] [::1]:37958 [200]: POST /ocs/v1.php/cloud/users
[3592] [Tue Apr 14 11:15:28 2026] [::1]:37970 [200]: GET /ocs/v1.php/cloud/users/user1
[3586] [Tue Apr 14 11:15:29 2026] [::1]:37976 [200]: GET /ocs/v2.php/cloud/users/user1
    And user "user1" exists                            # SharingContext::assureUserExists()
[3591] [Tue Apr 14 11:15:29 2026] [::1]:37990 [404]: GET /ocs/v2.php/cloud/users/user2
[3592] [Tue Apr 14 11:15:29 2026] [::1]:38004 [200]: POST /ocs/v1.php/cloud/users
[3586] [Tue Apr 14 11:15:30 2026] [::1]:38010 [200]: GET /ocs/v1.php/cloud/users/user2
[3591] [Tue Apr 14 11:15:30 2026] [::1]:38026 [200]: GET /ocs/v2.php/cloud/users/user2
    And user "user2" exists                            # SharingContext::assureUserExists()
    And As an "user0"                                  # SharingContext::asAn()
[3592] [Tue Apr 14 11:15:30 2026] [::1]:38042 [200]: POST /ocs/v1.php/apps/files_sharing/api/v1/shares
    When creating a share with                         # SharingContext::creatingShare()
      | path         | drop |
      | shareType    | 3    |
      | publicUpload | true |
    Then the OCS status code should be "100"           # SharingContext::theOCSStatusCodeShouldBe()
      Failed asserting that 404 matches expected '100'.

| shareType | 3 |
| publicUpload | true |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And As an "user2"
When accepting last share via the accept endpoint
Then the HTTP status code should be "404"
Loading