WebDav multiple props PROPFIND applied to folder returns incorrect file meta data

Steps to reproduce

  1. Have two or more files in a folder
    temp.txt
    test.txt

  2. PROPPATCH two or more prop values to the files:

curl -u admin:admin "http://localhost:8080/remote.php/dav/files/admin/test/temp.txt" -X PROPPATCH --data-binary @"patch1.txt"

<?xml version="1.0" encoding="utf-8" ?>
<a:propertyupdate xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
  <a:set>
      <a:prop>
        <oc:testvar1>AAAAAAAAAAAAAAAAAAAAAA</oc:testvar1>
        <oc:testvar2>BBBBBBBBBBBBBBBBBBBB</oc:testvar2>
      </a:prop>
  </a:set>
</a:propertyupdate>

curl -u admin:admin "http://localhost:8080/remote.php/dav/files/admin/test/test.txt" -X PROPPATCH --data-binary @"patch2.txt"

<?xml version="1.0" encoding="utf-8" ?>
    <a:propertyupdate xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
      <a:set>
          <a:prop>
            <oc:testvar1>CCCCCCCCCCCCCCCCCC</oc:testvar1>
            <oc:testvar2>DDDDDDDDDDDDDDDDDD</oc:testvar2>
          </a:prop>
      </a:set>
    </a:propertyupdate>
  1. PROPFIND two or more props at once in the folder:

curl -u admin:admin "http://localhost:8080/remote.php/dav/files/admin/test/" -X PROPFIND --data-binary @"find.txt"

<?xml version="1.0" encoding="utf-8" ?>
    <a:propfind xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
      <a:prop>
        <oc:testvar1/>
        <oc:testvar2/>
      </a:prop>
    </a:propfind>

Expected behaviour

The response should return the correct prop values for each file.

Actual behaviour

One of the prop variables is mixed up and returns the value of one of the files for all files.

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/dav/files/admin/test/</d:href>
    <d:propstat>
      <d:prop>
        <oc:testvar1/>
        <oc:testvar2/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/files/admin/test/temp.txt</d:href>
    <d:propstat>
      <d:prop>
        <oc:testvar1>CCCCCCCCCCCCCCCCCCCCCCCC</oc:testvar1>
        <oc:testvar2>BBBBBBBBBBBBBBBBBBBBBB</oc:testvar2>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/files/admin/test/test.txt</d:href>
    <d:propstat>
      <d:prop>
        <oc:testvar1>CCCCCCCCCCCCCCCCCCCCCCCC</oc:testvar1>
        <oc:testvar2>DDDDDDDDDDDDDDDDDDDDDDDD</oc:testvar2>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

When the multi-propfind is applied directly to a file, the result is correct.
When propfind with only one prop-request is applied to the folder, the result is correct.
When the multi-propfind is applied to the folder, the result is incorrect.

Server configuration

Operating system: Linux Docker (on Windows 10 Pro 64bit)

Web server: Docker Image

ownCloud version: 10.3.2 (stable)

Updated from an older ownCloud or fresh install: fresh install

Where did you install ownCloud from: Docker

Integrity: No errors have been found.

The content of config/config.php:
https://pastebin.com/1uy1upuV

Are you using an external user-backend, if yes which one: Webdav

Client configuration

Browser: Mozilla Firefox

Operating system: Windows 10 Pro 64bit

curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL

Can you perhaps explain what you’re trying to achieve? I don’t quite understand the use case.
Additionally why do you think this should be working?

I’ve had a quick search in the docs for PROPPATCH and all I could find is this:
https://doc.owncloud.com/server/10.3/developer_manual/webdav_api/comments.html#update-comments

So I think this is only supported for comments and not for the actual files at the moment.

Take my words with a grain of salt, I don’t know anything about this :wink: Perhaps an ownCloud dev like @jvillafanez or @karakayasemi can shed some light into this

1 Like

I would like to add and receive various custom meta properties to my files (f.e. file hashes). After having proppatched custom meta properties to my files, I would like to propfind that custom meta data for all files in a directory recursively. So that I get information about which files are in that directory and subdirectories and what custom meta values these files contain.

I hoped I could do this in one single propfind request. I get correct results if I request only a single custom meta property, but if I request multiple custom meta properties at once, the results become incorrect for some reason.

Aw, I hope it is or will be supported for files and folders too. Also, everything about this seems to work fine except for that one case.

(Could it be a sabredav bug maybe?)

1 Like

I think it’s supported because most of the stuff is working, but I don’t discard a bug somewhere because I don’t think this feature is used by a lot of people.

Could you double-check the properties you want to include are properly stored in the “oc_properties” table? They should be assigned to the correct fileid (matching the fileid column in the “oc_filecache” table). This will help us to narrow down where the problem is.

For checksums, you can try to ask for the <oc:checksums/> property. Those cheksums are provided by ownCloud when the file is downloaded (maybe if it’s uploaded through ownCloud too), so you don’t need to store them on your own.

2 Likes

The tables are correct.
oc_properties:

| 448 | 2428 | {http://owncloud.org/ns}testvar1 | AAAAAAAAAAAAAAAAAAAAAA |
| 449 | 2428 | {http://owncloud.org/ns}testvar2 | BBBBBBBBBBBBBBBBBBBBBB |
| 450 | 2424 | {http://owncloud.org/ns}testvar1 | DDDDDDDDDDDDDDDDDDDDDDDD |
| 451 | 2424 | {http://owncloud.org/ns}testvar2 | EEEEEEEEEEEEEEEEEEEEEEEE |
| 452 | 2428 | {http://owncloud.org/ns}testvar3 | CCCCCCCCCCCCCCCCCCCCCC |
| 453 | 2424 | {http://owncloud.org/ns}testvar3 | FFFFFFFFFFFFFFFFFFFFFFFF |

(I tested a bit and added a third property, that’s why they are not the same as in my initial post. The result is still incorrect though.)

oc_filecache:

| 2424 | 1 | files/test/test.txt
| 2428 | 1 | files/test/temp.txt

Good to know!

1 Like

If you have a github account, could you open a new ticket in https://github.com/owncloud/core/issues? I can do it for you if you don’t have an account.

2 Likes

Done: https://github.com/owncloud/core/issues/36920

2 Likes

If you feel confident about your skills, you can try to submit a pull request once you find the solution.
Note that this won’t be fixed for OC 10.4 (already late), but it might be for future versions. In addition, the ticket needs to be prioritized along with other bunch of things, so it could take a while to get it done.

2 Likes

The issue was fixed: https://github.com/owncloud/core/pull/37058

3 Likes