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

OCIS Response is empty when accepting a share #207

Closed
phil-davis opened this issue Sep 8, 2020 · 5 comments · Fixed by owncloud/core#38876
Closed

OCIS Response is empty when accepting a share #207

phil-davis opened this issue Sep 8, 2020 · 5 comments · Fixed by owncloud/core#38876
Assignees

Comments

@phil-davis
Copy link

phil-davis commented Sep 8, 2020

https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature#L31
Fails with:

  Scenario: When accepting a share of a file, the response is valid                                                         # /srv/app/testrunner/tests/acceptance/features/apiShareManagement/acceptSharesToSharesFolder.feature:30
    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 OCS status code should be "100"                                                                                # OCSContext::theOCSStatusCodeShouldBe()
      OCSContext::getOCSResponseStatusCode Received empty response where XML was expected (Exception)
    And the HTTP status code should be "200"                                                                                # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And the fields of the last response to user "Alice" sharing with user "Brian" should include                            # FeatureContext::checkFieldsOfLastResponseToUser()
      | share_with             | %username%            |
      | share_with_displayname | %displayname%         |
      | file_target            | /Shares/textfile0.txt |
      | path                   | /Shares/textfile0.txt |
      | permissions            | share,read,update     |
      | uid_owner              | %username%            |
      | displayname_owner      | %displayname%         |
      | item_type              | file                  |
      | mimetype               | text/plain            |
      | storage_id             | ANY_VALUE             |
      | share_type             | user                  |
    And the content of file "/Shares/textfile0.txt" for user "Brian" should be "ownCloud test text file 0" plus end-of-line # FeatureContext::contentOfFileForUserShouldBePlusEndOfLine()

Similarly if I do this with curl commands:

$ curl -k -u einstein:relativity https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d 'path=testFolder' -d 'shareWith=marie' -d 'shareType=0'
<?xml version="1.0" encoding="UTF-8"?>
<ocs><meta><status>ok</status><statuscode>100</statuscode><message>OK</message></meta><data><id>26acf798-987b-4e8a-a401-c2df292ecad5</id><share_type>0</share_type><uid_owner>4c510ada-c86b-4815-8820-42cdf82c3d51</uid_owner><displayname_owner>Albert Einstein</displayname_owner><permissions>31</permissions><stime>1599560793</stime><parent></parent><expiration></expiration><token></token><uid_file_owner>4c510ada-c86b-4815-8820-42cdf82c3d51</uid_file_owner><displayname_file_owner>Albert Einstein</displayname_file_owner><additional_info_owner></additional_info_owner><additional_info_file_owner></additional_info_file_owner><state>0</state><path>/testFolder</path><item_type>folder</item_type><mimetype>httpd/unix-directory</mimetype><storage_id>1284d238-aa92-42ce-bdc4-0b0000009154</storage_id><storage>0</storage><item_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmFhODg5Mjk4LWU0MmQtNDY5OC1hYTI3LWY5YzFiNDQ5OTgxYg==</item_source><file_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmFhODg5Mjk4LWU0MmQtNDY5OC1hYTI3LWY5YzFiNDQ5OTgxYg==</file_source><file_parent></file_parent><file_target>/testFolder</file_target><share_with>f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c</share_with><share_with_displayname>Marie Curie</share_with_displayname><share_with_additional_info></share_with_additional_info><mail_send>0</mail_send><name></name></data></ocs>

$ curl -k -u marie:radioactivity https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares?format=json\&shared_with_me=true\&state=pending
{"ocs":{"meta":{"status":"ok","statuscode":100,"message":"OK"},"data":[{"id":"0d0ed2a5-4864-463c-916b-2035c2083399","share_type":0,"uid_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_owner":"Albert Einstein","permissions":15,"stime":1599549553,"parent":"","expiration":"","token":"","uid_file_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_file_owner":"Albert Einstein","additional_info_owner":"","additional_info_file_owner":"","state":0,"path":"","item_type":"","mimetype":"","storage_id":"","storage":0,"item_source":"","file_source":"","file_parent":"","file_target":"","share_with":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","share_with_displayname":"Marie Curie","share_with_additional_info":"","mail_send":0,"name":""},{"id":"8dc8b220-d740-4fcf-a897-f04bf54380f0","share_type":0,"uid_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_owner":"Albert Einstein","permissions":15,"stime":1599553203,"parent":"","expiration":"","token":"","uid_file_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_file_owner":"Albert Einstein","additional_info_owner":"","additional_info_file_owner":"","state":1,"path":"","item_type":"","mimetype":"","storage_id":"","storage":0,"item_source":"","file_source":"","file_parent":"","file_target":"","share_with":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","share_with_displayname":"Marie Curie","share_with_additional_info":"","mail_send":0,"name":""},{"id":"fcc85b7d-2b23-4ae4-878d-056aa3c0d87a","share_type":0,"uid_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_owner":"Albert Einstein","permissions":3,"stime":1599554880,"parent":"","expiration":"","token":"","uid_file_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_file_owner":"Albert Einstein","additional_info_owner":"","additional_info_file_owner":"","state":0,"path":"/text.txt","item_type":"file","mimetype":"text/plain","storage_id":"1284d238-aa92-42ce-bdc4-0b0000009154","storage":0,"item_source":"MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmM0MWRjNTBjLTUwNmQtNDBlOC1iY2JjLTNhYTI3MDEwYjAwNw==","file_source":"MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmM0MWRjNTBjLTUwNmQtNDBlOC1iY2JjLTNhYTI3MDEwYjAwNw==","file_parent":"","file_target":"/text.txt","share_with":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","share_with_displayname":"Marie Curie","share_with_additional_info":"","mail_send":0,"name":""},{"id":"26acf798-987b-4e8a-a401-c2df292ecad5","share_type":0,"uid_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_owner":"Albert Einstein","permissions":31,"stime":1599560793,"parent":"","expiration":"","token":"","uid_file_owner":"4c510ada-c86b-4815-8820-42cdf82c3d51","displayname_file_owner":"Albert Einstein","additional_info_owner":"","additional_info_file_owner":"","state":1,"path":"/testFolder","item_type":"folder","mimetype":"httpd/unix-directory","storage_id":"1284d238-aa92-42ce-bdc4-0b0000009154","storage":0,"item_source":"MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmFhODg5Mjk4LWU0MmQtNDY5OC1hYTI3LWY5YzFiNDQ5OTgxYg==","file_source":"MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmFhODg5Mjk4LWU0MmQtNDY5OC1hYTI3LWY5YzFiNDQ5OTgxYg==","file_parent":"","file_target":"/testFolder","share_with":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","share_with_displayname":"Marie Curie","share_with_additional_info":"","mail_send":0,"name":""}]}}

$ curl -k -u marie:radioactivity https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares/pending/26acf798-987b-4e8a-a401-c2df292ecad5 -X POST

The response to that last command has HTTP status 200, success. But the body is empty. In oC10 there are a whole list of fields with data about the share that was accepted.

This prevents a lot of sharing tests from being able to pass, because shares have to be accepted in OCIS, and the response to accepting a share is missing expected stuff.

@individual-it
Copy link
Member

should have been fixed by cs3org/reva#1685 but not all tests got removed from expected to fail, after that fix arrives in ocis we need to double check why the other tests still fail and put them in the correct categories

@phil-davis
Copy link
Author

Note: this has come to OCIS and the OCIS commit id is being updated in web PR owncloud/web#5179

I will move this issue into the current sprint so that someone looks at the remaining expected-failures to record correctly why they still fail.

@kiranparajuli589 kiranparajuli589 self-assigned this Jun 3, 2021
@individual-it
Copy link
Member

requesting only pending shares does not work for me, I had to request &state=all to get the shares of marie, maybe that is the remaining or new issue

@kiranparajuli589
Copy link

At the date of the comment,

requesting for pending shares is possible:

curl -k -u uu1:uu1 https://localhost:9200/ocs/v2.php/apps/files_sharing//api/v1/shares\?format\=json\&shared_with_me\=true\&state\=1\&include_tags\=false\&format\=json | jq

Response:

{
  "ocs": {
    "meta": {
      "status": "ok",
      "statuscode": 200,
      "message": "OK"
    },
    "data": [
      {
        "id": "d83ffee2-e418-4530-ab2d-553f9695ab59",
        "share_type": 0,
        "uid_owner": "admin",
        "displayname_owner": "Admin",
        "additional_info_owner": "admin@example.org",
        "permissions": 1,
        "stime": 1622811093,
        "parent": "",
        "expiration": "",
        "token": "",
        "uid_file_owner": "admin",
        "displayname_file_owner": "Admin",
        "additional_info_file_owner": "admin@example.org",
        "state": 1,
        "path": "/buff_biryani.jpg",
        "item_type": "file",
        "mimetype": "image/jpeg",
        "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009157",
        "storage": 0,
        "item_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OmQ4N2Y1MDA5LTg0OGQtNDJiMC04MTQwLTFhNjlhZTc2YTVkYg==",
        "file_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OmQ4N2Y1MDA5LTg0OGQtNDJiMC04MTQwLTFhNjlhZTc2YTVkYg==",
        "file_parent": "",
        "file_target": "/buff_biryani.jpg",
        "share_with": "uu1",
        "share_with_displayname": "uu1",
        "share_with_additional_info": "uu1@oc.cc",
        "mail_send": 0,
        "name": ""
      }
    ]
  }
}
  • Accepting a share provides share as a response:
curl -k -u uu1:uu1 -X  POST https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/d83ffee2-e418-4530-ab2d-553f9695ab59\?format\=json | jq

Response:

{
  "ocs": {
    "meta": {
      "status": "ok",
      "statuscode": 200,
      "message": "OK"
    },
    "data": [
      {
        "id": "d83ffee2-e418-4530-ab2d-553f9695ab59",
        "share_type": 0,
        "uid_owner": "admin",
        "displayname_owner": "Admin",
        "additional_info_owner": "admin@example.org",
        "permissions": 1,
        "stime": 1622811093,
        "parent": "",
        "expiration": "",
        "token": "",
        "uid_file_owner": "admin",
        "displayname_file_owner": "Admin",
        "additional_info_file_owner": "admin@example.org",
        "state": 0,
        "path": "/Shares/buff_biryani.jpg",
        "item_type": "file",
        "mimetype": "image/jpeg",
        "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009157",
        "storage": 0,
        "item_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OmQ4N2Y1MDA5LTg0OGQtNDJiMC04MTQwLTFhNjlhZTc2YTVkYg==",
        "file_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OmQ4N2Y1MDA5LTg0OGQtNDJiMC04MTQwLTFhNjlhZTc2YTVkYg==",
        "file_parent": "",
        "file_target": "/Shares/buff_biryani.jpg",
        "share_with": "uu1",
        "share_with_displayname": "uu1",
        "share_with_additional_info": "uu1@oc.cc",
        "mail_send": 0,
        "name": ""
      }
    ]
  }
}

@kiranparajuli589
Copy link

I will check the expected failures (if needs update) on Monday!

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

Successfully merging a pull request may close this issue.

3 participants