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

500 status code on update share #2011

Closed
jasson99 opened this issue May 4, 2021 · 8 comments
Closed

500 status code on update share #2011

jasson99 opened this issue May 4, 2021 · 8 comments
Labels

Comments

@jasson99
Copy link
Contributor

jasson99 commented May 4, 2021

Describe the bug

In ocis, when a user tries to update the last created share using the int value of the share_id, the status code is 500 when ocs_api_version 2 is used.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create users Alice, Brian and Carol
  2. As user Alice, create a folder /TMP and share the folder with user Brian
  3. As user Brian, get all the shares and accept the share /TMP as:
curl -k -X GET https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares\?shared_with_me\=true\&state\=all -u Brian:1234 | xmllint --format -

<ocs>
  <meta>
    <status>ok</status>
    <statuscode>200</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>6c1276d3-a4d7-4690-8737-93ee9fa355db</id>
       .
       .
    </element>
  </data>
</ocs>
curl -k -X POST https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/6c1276d3-a4d7-4690-8737-93ee9fa355db -u Brian:1234
  1. As user Brian, share folder Shares/TMP with user Carol
  2. As user Carol, get all the shares and accept the share Shares/TMP as
curl -k -X GET https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares\?shared_with_me\=true\&state\=all -u Carol:1234 | xmllint --format -

<ocs>
  <meta>
    <status>ok</status>
    <statuscode>200</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>27238dc5-b2c2-4c6f-8ce8-e64c0d742770</id>
       .
       .
    </element>
  </data>
</ocs>

curl -k -X POST https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/27238dc5-b2c2-4c6f-8ce8-e64c0d742770 -u Carol:1234 -v;
  1. As user Alice, get all the shares and update the last share as:
curl -k -X GET https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares -u Alice:1234 | xmllint --format -

    <element>
      <id>6c1276d3-a4d7-4690-8737-93ee9fa355db</id>
      <share_type>0</share_type>
      <uid_owner>Alice</uid_owner>
      <displayname_owner>Alice</displayname_owner>
      <additional_info_owner>Alice@example.com</additional_info_owner>
      <permissions>23</permissions>
      ...
      <uid_file_owner>Alice</uid_file_owner>
      <displayname_file_owner>Alice</displayname_file_owner>
      <additional_info_file_owner>Alice@example.com</additional_info_file_owner>
      <state>0</state>
      <path>/TMP</path>
      <item_type>folder</item_type>
      ...
      <file_target>/TMP</file_target>
      <share_with>Brian</share_with>
      <share_with_displayname>Brian</share_with_displayname>
      <share_with_additional_info>Brian@example.com</share_with_additional_info>
      ...
    </element>
    <element>
      <id>27238dc5-b2c2-4c6f-8ce8-e64c0d742770</id>
      <share_type>0</share_type>
      <uid_owner>Brian</uid_owner>
      <displayname_owner>Brian</displayname_owner>
      <additional_info_owner>Alice@example.com</additional_info_owner>
      <permissions>23</permissions>
      ...
      <uid_file_owner>Alice</uid_file_owner>
      <displayname_file_owner>Alice</displayname_file_owner>
      <additional_info_file_owner>Brian@example.com</additional_info_file_owner>
      <state>0</state>
      <path>/TMP</path>
      <item_type>folder</item_type>
       ...
      <file_target>/TMP</file_target>
      <share_with>Carol</share_with>
      <share_with_displayname>Carol</share_with_displayname>
      <share_with_additional_info>Carol@example.com</share_with_additional_info>
      <mail_send>0</mail_send>
    </element>

curl -k -X PUT https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/6 -u Alice:1234 -d permissions=7

< HTTP/1.1 500 Internal Server Error
<ocs><meta><status>error</status><statuscode>996</statuscode><message>grpc update share request failed</message></meta></ocs>

Expected behavior

The share should be updated with the integer value as with ocs_api_version 1.

Actual behavior

While using the integer value of the share_id to update the share, the server responds with 500 internal server error.
WIth the actual share_id used, the share is actually updated, but after the share permisson has been updated, the share receiver Brian gets 500 server error when the share to Carol is tried to be deleted.

In short, the behavior on Ocs_api_version 1 and Ocs_api_version 2 are different.

@jasson99
Copy link
Contributor Author

jasson99 commented May 4, 2021

In step 6, when user Alice updates the share using the share_id instead of the integer value of the share id, as follows:

curl -k -X PUT https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/6c1276d3-a4d7-4690-8737-93ee9fa355db -u Alice:1234 -d permissions=1 -v;

<ocs>
  <meta>
    <status>ok</status>
    <statuscode>200</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <id>6c1276d3-a4d7-4690-8737-93ee9fa355db</id>
    <share_type>0</share_type>
    <uid_owner>Alice</uid_owner>
    <displayname_owner>Alice</displayname_owner>
    <additional_info_owner>Alice@example.com</additional_info_owner>
    <permissions>1</permissions>
    ...
    <uid_file_owner>Alice</uid_file_owner>
    <displayname_file_owner>Alice</displayname_file_owner>
    <additional_info_file_owner>Alice@example.com</additional_info_file_owner>
    <state>0</state>
    <path>/TMP</path>
    <item_type>folder</item_type>
   ...
    <file_target>/TMP</file_target>
    <share_with>Brian</share_with>
    <share_with_displayname>Brian</share_with_displayname>
    <share_with_additional_info>Brian@example.com</share_with_additional_info>
    <mail_send>0</mail_send>
    <name/>
  </data>
</ocs>

However, now when user Brian deletes his last share as:
curl -k -X DELETE https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/27238dc5-b2c2-4c6f-8ce8-e64c0d742770 -u Brian:1234 -v;

The response is:


HTTP/1.1 500 Internal Server Error

<ocs><meta><status>error</status><statuscode>996</statuscode><message>grpc delete share request failed</message></meta></ocs>

But the share to user Carol is actually deleted

@jasson99
Copy link
Contributor Author

jasson99 commented May 4, 2021

Now, the behaviour is different when using ocs-api-version 1.

  1. Create users Alice, Brian and Carol
  2. As user Alice, create a folder/TMP and share the folder with user Brian
  3. As user Brian, accept the share /TMP as
  4. As user Brian, share folder Shares/TMP with user Carol
  5. As user Carol, accept share Shares/TMP as follows:

curl -k -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares/pending/63aa1bff-a412-4ee3-afe5-cbfd758a64b5 -u Carol:1234 -v;

  1. As user Alice, get all the shares and update the last share using its integer value by changing its permissions as:
    curl -k -X GET https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -u Alice:1234 | xmllint --format -
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>cb756408-e345-4448-9d0a-d90d7aeb1c2c</id>
      <share_type>0</share_type>
      <uid_owner>Alice</uid_owner>
      <displayname_owner>Alice</displayname_owner>
      <additional_info_owner>Alice@example.com</additional_info_owner>
      <permissions>23</permissions>
      <stime>1620132640</stime>
      <parent/>
      <expiration/>
      <token/>
      <uid_file_owner>Alice</uid_file_owner>
      <displayname_file_owner>Alice</displayname_file_owner>
      <additional_info_file_owner>Alice@example.com</additional_info_file_owner>
      <state>0</state>
      <path>/TMP</path>
      <item_type>folder</item_type>
      ...
      <file_target>/TMP</file_target>
      <share_with>Brian</share_with>
      <share_with_displayname>Brian</share_with_displayname>
      <share_with_additional_info>Brian@example.com</share_with_additional_info>
      <mail_send>0</mail_send>
      <name/>
    </element>
    <element>
      <id>63aa1bff-a412-4ee3-afe5-cbfd758a64b5</id>
      <share_type>0</share_type>
      <uid_owner>Brian</uid_owner>
      <displayname_owner>Brian</displayname_owner>
      <additional_info_owner>Alice@example.com</additional_info_owner>
      <permissions>23</permissions>
      ...
      <uid_file_owner>Alice</uid_file_owner>
      <displayname_file_owner>Alice</displayname_file_owner>
      <additional_info_file_owner>Brian@example.com</additional_info_file_owner>
      <state>0</state>
      <path>/TMP</path>
      <item_type>folder</item_type>
     ... 
      <file_target>/TMP</file_target>
      <share_with>Carol</share_with>
      <share_with_displayname>Carol</share_with_displayname>
      <share_with_additional_info>Carol@example.com</share_with_additional_info>
      <mail_send>0</mail_send>
      <name/>
    </element>
  </data>
</ocs>

curl -k -X PUT https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares/0 -u Alice:1234 -d permissions=1 -v;

HTTP/1.1 200 OK

However, with status code 200, the permisson is not updated, and hence, the share with Brian for which the permission has been updated is still has Advanced Permissions instead of Viewer

@jasson99
Copy link
Contributor Author

jasson99 commented May 4, 2021

Investigation of: #1999

@kulmann
Copy link
Member

kulmann commented May 4, 2021

Duplicate of #1950 ? If yes, please close.

@jasson99
Copy link
Contributor Author

jasson99 commented May 5, 2021

Duplicate of #1950 ? If yes, please close.

NO. This is different issue.

@phil-davis
Copy link
Contributor

Note: #1999 has been closed, and the entry in expected-failures has been updated to link to this issue #2011

@kobergj
Copy link
Collaborator

kobergj commented Jun 4, 2024

Since this is 3 years old I consider it either fixed or not relevant enough to be fixed. Closing.

@kobergj kobergj closed this as completed Jun 4, 2024
@phil-davis
Copy link
Contributor

The issue number is no longer mentioned in expected-failures, so it must have been fixed.

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

No branches or pull requests

4 participants