owncloud / product

ownCloud Product Backlog
GNU Lesser General Public License v3.0
0 stars 1 forks source link

After accepting a share in OCIS data in the received file cannot be downloaded #208

Open phil-davis opened 4 years ago

phil-davis commented 4 years ago

This scenario is failing: https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature#L15

https://cloud.drone.io/owncloud/ocis/1488/4/7

  Background:                                                                     # /srv/app/testrunner/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature:7
    Given using OCS API version "1"                                               # FeatureContext::usingOcsApiVersion()
    And using new DAV path                                                        # FeatureContext::usingOldOrNewDavPath()
    And these users have been created with default attributes and skeleton files: # FeatureContext::theseUsersHaveBeenCreated()
      | username |
      | Alice    |
      | Brian    |

  Scenario: When accepting a share of a file, the received file is accessible                                                # /srv/app/testrunner/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature:15
    Given the administrator has set the default folder for received shares to "Shares"                                       # OccContext::theAdministratorHasSetTheDefaultFolderForReceivedSharesTo()
    And parameter "shareapi_auto_accept_share" of app "core" has been set to "no"                                            # AppConfigurationContext::serverParameterHasBeenSetTo()
    And user "Alice" has shared file "/textfile0.txt" with user "Brian"                                                      # FeatureContext::userHasSharedFileWithUserUsingTheSharingApi()
    When user "Brian" accepts the share "/textfile0.txt" offered by user "Alice" using the sharing API                       # FeatureContext::userReactsToShareOfferedBy()
    Then the content of file "/Shares/textfile0.txt" for user "Brian" should be "ownCloud test text file 0" plus end-of-line # FeatureContext::contentOfFileForUserShouldBePlusEndOfLine()
      The downloaded content was expected to be 'ownCloud test text file 0
      ', but actually is ''.
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
      -'ownCloud test text file 0\n
      -'
      +''

See #207 for a different issue - when the share is accepted the share does get created but the response body is empty.

In this issue, the test scenario accepts the share and does not bother to check the response body. It tries to download the received shared file. The download seems to "work" but the file content does not actually come - it seems empty.

phil-davis commented 4 years ago

When I do similar actions locally in Phoenix, I get: Screenshot from 2020-09-08 14-41-56

And the OCIS server has:

2020-09-08T14:36:00+05:45 ERR Error fetching from accounts-service error="{\"id\":\"go.micro.client\",\"code\":500,\"detail\":\"service com.owncloud.api.accounts: not found\",\"status\":\"Internal Server Error\"}" query="id eq 'f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c'" service=proxy
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:55760 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=97523 traceid=22de6a3f78a38d539e76ba8b74a7dfba uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProvider user-agent=grpc-go/1.26.0
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:49038 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=195137 traceid=22de6a3f78a38d539e76ba8b74a7dfba uri=/cs3.storage.provider.v1beta1.ProviderAPI/CreateHome user-agent=grpc-go/1.26.0
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:55628 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=941759 traceid=22de6a3f78a38d539e76ba8b74a7dfba uri=/cs3.gateway.v1beta1.GatewayAPI/CreateHome user-agent=grpc-go/1.26.0
2020-09-08T14:36:01+05:45 INF access token is already provided pkg=rhttp service=reva traceid=3a6bf665dbdb24857ea0ef927eb07a2e
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:55760 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=99492 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProvider user-agent=grpc-go/1.26.0
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:49038 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=662701 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.storage.provider.v1beta1.ProviderAPI/Stat user-agent=grpc-go/1.26.0
2020-09-08T14:36:01+05:45 INF unary code=OK end="08/Sep/2020:14:36:01 +0545" from=tcp://127.0.0.1:55760 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=72400 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProvider user-agent=grpc-go/1.26.0
2020-09-08T14:36:03+05:45 INF unary code=OK end="08/Sep/2020:14:36:03 +0545" from=tcp://127.0.0.1:37766 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=1959581380 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.identity.user.v1beta1.UserAPI/GetUser user-agent=grpc-go/1.26.0
2020-09-08T14:36:03+05:45 INF unary code=OK end="08/Sep/2020:14:36:03 +0545" from=tcp://127.0.0.1:49038 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=1960752785 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.storage.provider.v1beta1.ProviderAPI/Stat user-agent=grpc-go/1.26.0
2020-09-08T14:36:03+05:45 INF unary code=OK end="08/Sep/2020:14:36:03 +0545" from=tcp://127.0.0.1:55748 pkg=rgrpc service=reva start="08/Sep/2020:14:36:01 +0545" time_ns=1962731188 traceid=3a6bf665dbdb24857ea0ef927eb07a2e uri=/cs3.gateway.v1beta1.GatewayAPI/Stat user-agent=grpc-go/1.26.0
2020-09-08T14:36:03+05:45 ERR gateway: error downloading error="error: permission denied: gateway: cannot download share folder or share name: path=/home/Shares/text.txt" pkg=rgrpc service=reva traceid=3a6bf665dbdb24857ea0ef927eb07a2e

Maybe the accounts service goes down? And then there is no way to sort out the permissions...?

phil-davis commented 4 years ago

This might have a common solution to #205

Fixing this should get at least some scenarios passing in https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature

butonic commented 4 years ago

the problem is that the reva gateway logic was built with folder shares only in mind. It would check if an up / download was targeted at a direct child of a users "/Shares" folder and would immediately deny the request. https://github.com/cs3org/reva/pull/1170 should allow that for files.