owncloud / owncloud/core

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

Open
#39,820 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Bug
Dominant language
PHP
Stars
8.8k
Forks
2.1k
Avg merge
20h 7m
Merged PRs (30d)
41

Description

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>einstein@example.org</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>einstein@example.org</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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the public-link sharing OCS API and the WebDAV MOVE flow shown in the reproduction commands. Trace how renaming updates path but leaves file_target unchanged, then reproduce the request sequence and verify that both values contain /new-lorem.txt after the rename.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.