nextcloud / nextcloud/server

[Bug]: Cannot retrieve custom properties of metadata files through PROPFIND if it is from a file that has been shared with you

Open
#53,155 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 31-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Cannot retrieve custom properties of metadata files through PROPFIND if it is from a file that has been shared with you

Steps to reproduce
  1. Create a document.txt file with user1 in root
  2. Execute with curl these requests:
curl -u user1:user1 'http://localhost:8080/remote.php/dav/files/user1/document.txt' -X PROPPATCH --data '<?xml version="1.0" encoding="UTF-8"?>
    <d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
        <d:set>
            <d:prop>
                <nc:metadata-myapp-test>123</nc:metadata-myapp-test>
            </d:prop>
        </d:set>
    </d:propertyupdate>'

curl -u user1:user1 'http://localhost:8080/remote.php/dav/files/user1/document.txt' -X PROPFIND --data '<?xml version="1.0" encoding="UTF-8"?>
    <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
        <d:prop>
            <nc:metadata-myapp-test />
        </d:prop>
    </d:propfind>'

Correct result:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/document.txt</d:href><d:propstat><d:prop><nc:metadata-myapp-test/></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/document.txt</d:href><d:propstat><d:prop><nc:metadata-myapp-test>123</nc:metadata-myapp-test></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
  1. Share the file of user1 with user2 and execute this request:
curl -u user2:user2 'http://localhost:8080/remote.php/dav/files/user2/document.txt' -X PROPFIND --data '<?xml version="1.0" encoding="UTF-8"?>
    <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
        <d:prop>
            <nc:metadata-myapp-test />
        </d:prop>
    </d:propfind>'

Incorrect result (cannot find metadata-myapp-test):

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/local/document.txt</d:href><d:propstat><d:prop><nc:metadata-myapp-test/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
Expected behavior

It should return the results of the metadata-myapp-test property correctly as it does with those of the sharing user.

Nextcloud Server version

31

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

No response

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 at the remote.php/dav/files/{user}/document.txt PROPFIND path and compare property handling for the owner and the recipient of a shared file. Reproduce the PROPPATCH and PROPFIND requests from the issue; done means the recipient receives metadata-myapp-test with value 123 and a 200 response for the shared file.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.