Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy file to received shared file #40787

Open
phil-davis opened this issue May 15, 2023 · 5 comments
Open

Copy file to received shared file #40787

phil-davis opened this issue May 15, 2023 · 5 comments

Comments

@phil-davis
Copy link
Contributor

phil-davis commented May 15, 2023

Steps to reproduce

  1. Alice creates a file "test.txt" with content "original text"
  2. Alice shares the file with Brian
  3. Brian creates a file "new.txt" with content "new text"
  4. Brian copies "new.txt" to "test.txt"

Expected behaviour

Both Alice and Brian see that "test.txt" has the content "new text"

Actual behaviour

Brian now has "test.txt" has the content "new text"
The share from Alice to Brian is in the declined state
Alice has "test.txt" has the content "original text"

When Brian accepts the declined share from Alice, then Brian sees "test (2).txt" with content "original text"

Server configuration

Current oC10 core master

See PR #40308 for the test scenario(s)

@phil-davis
Copy link
Contributor Author

phil-davis commented May 15, 2023

Note: when the files are both "owned" by the same user, then that user can copy from one file to the other and the content is copied (the expected behavior)

    Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
    And user "Alice" has uploaded file with content "ownCloud test text file 1" to "/textfile1.txt"
    When user "Alice" copies file "/textfile0.txt" to "/textfile1.txt" using the WebDAV API
    Then the HTTP status code should be "204"
    And the content of file "/textfile1.txt" for user "Alice" should be "ownCloud test text file 0"

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Copy link

This issue has been automatically closed.

@phil-davis phil-davis self-assigned this Dec 13, 2023
@phil-davis
Copy link
Contributor Author

The scenario for this will still fail. The suggested behavior still needs to be implemented.

$ make test-acceptance-api BEHAT_FEATURE=tests/acceptance/features/apiWebdavProperties1/copyFile.feature:289
...
Feature: copy file
  As a user
  I want to be able to copy files
  So that I can manage my files

  Background:                                                                                       # /home/phil/git/owncloud/core/tests/acceptance/features/apiWebdavProperties1/copyFile.feature:7
    Given using OCS API version "1"                                                                 # FeatureContext::usingOcsApiVersion()
    And the administrator has set the default folder for received shares to "Shares"                # OccContext::theAdministratorHasSetTheDefaultFolderForReceivedSharesTo()
    And auto-accept shares has been disabled                                                        # FeatureContext::autoAcceptSharesHasBeenDisabled()
    And user "Alice" has been created with default attributes and without skeleton files            # FeatureContext::userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles()
    And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" # FeatureContext::userHasUploadedAFileWithContentTo()
    And user "Alice" has uploaded file with content "ownCloud test text file 1" to "/textfile1.txt" # FeatureContext::userHasUploadedAFileWithContentTo()
    And user "Alice" has created folder "/FOLDER"                                                   # FeatureContext::userHasCreatedFolder()

  @issue-40787 @files_sharing-app-required
  Scenario Outline: copy a file over the top of an existing file received as a user share                    # /home/phil/git/owncloud/core/tests/acceptance/features/apiWebdavProperties1/copyFile.feature:289
    Given using <dav_version> DAV path                                                                       # FeatureContext::usingOldOrNewDavPath()
    And user "Brian" has been created with default attributes and without skeleton files                     # FeatureContext::userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles()
    And user "Brian" has uploaded file with content "file to share" to "/sharedfile1.txt"                    # FeatureContext::userHasUploadedAFileWithContentTo()
    And user "Brian" has shared file "/sharedfile1.txt" with user "Alice"                                    # FeatureContext::userHasSharedFileWithUserUsingTheSharingApi()
    And user "Alice" has accepted share "/sharedfile1.txt" offered by user "Brian"                           # FeatureContext::userHasReactedToShareOfferedBy()
    When user "Alice" copies file "/textfile1.txt" to "/Shares/sharedfile1.txt" using the WebDAV API         # FeatureContext::userCopiesFileUsingTheAPI()
    Then the HTTP status code should be "204"                                                                # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And as "Alice" file "/Shares/sharedfile1.txt" should exist                                               # FeatureContext::asFileOrFolderShouldExist()
    And the content of file "/Shares/sharedfile1.txt" for user "Alice" should be "ownCloud test text file 1" # FeatureContext::contentOfFileForUserShouldBe()
    And as "Alice" file "/textfile1.txt" should exist                                                        # FeatureContext::asFileOrFolderShouldExist()
    And as "Brian" file "/sharedfile1.txt" should exist                                                      # FeatureContext::asFileOrFolderShouldExist()
    And the content of file "/sharedfile1.txt" for user "Brian" should be "ownCloud test text file 1"        # FeatureContext::contentOfFileForUserShouldBe()

    Examples:
      | dav_version |
      | old         |
        Failed step: And the content of file "/sharedfile1.txt" for user "Brian" should be "ownCloud test text file 1"
        The content was expected to be 'ownCloud test text file 1', but actually is 'file to share'. HTTP status was 200
        Failed asserting that two strings are equal.
        --- Expected
        +++ Actual
        @@ @@
        -'ownCloud test text file 1'
        +'file to share'
      | new         |
        Failed step: And the content of file "/sharedfile1.txt" for user "Brian" should be "ownCloud test text file 1"
        The content was expected to be 'ownCloud test text file 1', but actually is 'file to share'. HTTP status was 200
        Failed asserting that two strings are equal.
        --- Expected
        +++ Actual
        @@ @@
        -'ownCloud test text file 1'
        +'file to share'

--- Failed scenarios:

    /home/phil/git/owncloud/core/tests/acceptance/features/apiWebdavProperties1/copyFile.feature:304
    /home/phil/git/owncloud/core/tests/acceptance/features/apiWebdavProperties1/copyFile.feature:305

2 scenarios (2 failed)
38 steps (36 passed, 2 failed)

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

1 participant