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

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

Closed
Papts opened this issue Feb 10, 2020 · 3 comments · Fixed by #37058
Closed

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

Papts opened this issue Feb 10, 2020 · 3 comments · Fixed by #37058
Assignees
Labels

Comments

@Papts
Copy link

Papts commented Feb 10, 2020

I would like to add and receive various custom meta properties to my files. 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.

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.

I also checked the MariaDB tables oc_properties and oc_filecache, they are set correctly.

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

(continued from https://central.owncloud.org/t/webdav-multiple-props-propfind-applied-to-folder-returns-incorrect-file-meta-data/24126)

@phil-davis
Copy link
Contributor

I added QA-team labels, we need some acceptance tests that check combinations of PROPFIND stuff, including the type of scenarios here. But also for doing "ordinary" multi-PROPFIND of the "ordinary" properties of files in a folder etc.

I expect that will easily demonstrate the issue above. Then someone can fix it.

@kiranparajuli589 please get someone to look at acceptance tests.

@phil-davis
Copy link
Contributor

@Papts thanks for the nice report - those examples should make it easy to reproduce.

@phil-davis
Copy link
Contributor

PR #36941 has the scenario that demonstrates this bug.
Removing QA labels - over to devs to fix.

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

Successfully merging a pull request may close this issue.

4 participants