core icon indicating copy to clipboard operation
core copied to clipboard

file_target is not updated in public link share after the file has been renamed

Open SwikritiT opened this issue 3 years ago • 0 comments

Steps to reproduce

  1. Create a user test
  2. Upload a file lorem.txt : curl -u test:test -X PUT http://localhost/core/remote.php/webdav/lorem.txt -d"123"
  3. Share the file with public link : curl -u test:test 'http://localhost/core/ocs/v1.php/apps/files_sharing/api/v1/shares' --data-raw 'shareType=3&path=%2Florem.txt&permissions=1'
  4. check the share : curl -u test:test 'http://localhost/core/ocs/v1.php/apps/files_sharing/api/v1/shares' | xmllint --format - file_target has the value /lorem.txt
  5. rename the file to new-lorem.txt: curl -u test:test -X MOVE http://localhost/core/remote.php/webdav/lorem.txt -H"Destination: http://localhost/core/remote.php/webdav/new-lorem.txt"
  6. check the share : curl -u test:test 'http://localhost/core/ocs/v1.php/apps/files_sharing/api/v1/shares' | xmllint --format - the value of path is changed <path>/new-lorem.txt</path> but file target is same <file_target>/lorem.txt</file_target>

Expected behaviour

Tell us what should happen Both the path and file_target should be updated with new value as in OCIS

<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>TLyicbxeGOrbNtz</id>
      <share_type>3</share_type>
      <uid_owner>einstein</uid_owner>
      <displayname_owner>Albert Einstein</displayname_owner>
      <additional_info_owner>[email protected]</additional_info_owner>
      <permissions>1</permissions>
      <stime>1645507832</stime>
      <parent/>
      <expiration/>
      <token>ZkjaPJybdGNrRXv</token>
      <uid_file_owner>einstein</uid_file_owner>
      <displayname_file_owner>Albert Einstein</displayname_file_owner>
      <additional_info_file_owner>[email protected]</additional_info_file_owner>
      <state>0</state>
      <path>/new-lorem.txt</path>
      <item_type>file</item_type>
      <mimetype>text/plain</mimetype>
      <storage_id>shared::/new-lorem.txt</storage_id>
      <storage>0</storage>
      <item_source>NGM1MTBhZGEtYzg2Yi00ODE1LTg4MjAtNDJjZGY4MmMzZDUxOjRiNzU5OTQzLTJiNjktNDg0Zi04NmJkLWE1OTA4YTJkZDQ0Mw==</item_source>
      <file_source>NGM1MTBhZGEtYzg2Yi00ODE1LTg4MjAtNDJjZGY4MmMzZDUxOjRiNzU5OTQzLTJiNjktNDg0Zi04NmJkLWE1OTA4YTJkZDQ0Mw==</file_source>
      <file_parent/>
      <file_target>/new-lorem.txt</file_target>
      <share_with_additional_info/>
      <mail_send>0</mail_send>
      <name/>
      <url>https://localhost:9200/#/s/ZkjaPJybdGNrRXv</url>
    </element>
  </data>
</ocs>

Actual behaviour

Only path is updated and not the file_target

<?xml version="1.0"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
    <totalitems/>
    <itemsperpage/>
  </meta>
  <data>
    <element>
      <id>4746</id>
      <share_type>3</share_type>
      <uid_owner>test</uid_owner>
      <displayname_owner>test</displayname_owner>
      <permissions>1</permissions>
      <stime>1645520668</stime>
      <parent/>
      <expiration/>
      <token>A72sONViB8kJ282</token>
      <uid_file_owner>test</uid_file_owner>
      <displayname_file_owner>test</displayname_file_owner>
      <additional_info_owner/>
      <additional_info_file_owner/>
      <path>/new-lorem.txt</path>
      <mimetype>text/plain</mimetype>
      <storage_id>home::test</storage_id>
      <storage>13026</storage>
      <item_type>file</item_type>
      <item_source>2147718417</item_source>
      <file_source>2147718417</file_source>
      <file_parent>2147716504</file_parent>
      <file_target>/lorem.txt</file_target>
      <name/>
      <url>http://localhost/core/index.php/s/A72sONViB8kJ282</url>
      <mail_send>0</mail_send>
      <attributes/>
    </element>
  </data>
</ocs>

Server configuration

latest master

SwikritiT avatar Feb 22 '22 09:02 SwikritiT