Skip to content

Wrong fileid when requesting files list via webdav with Depth: infinity #31238

Closed

Description

@PaulAnnekov

Steps to reproduce

  1. Call curl -u "user:password" -X PROPFIND -H "Depth: infinity" -H "Content-Type: text/xml" --data-binary "@/tmp/propfind-fileid.xml" "http://localhost/remote.php/webdav/folder" | xmllint --format - where /tmp/propfind-fileid.xml contains:
<?xml version="1.0"?>
<a:propfind xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
    <!-- retrieve the file's id -->
    <a:prop><oc:fileid/></a:prop>
</a:propfind>
  1. You will get something like this:
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/webdav/folder/</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>225364</oc:fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/webdav/folder/1.jpg</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>225364</oc:fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/webdav/folder/2.jpg</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>225364</oc:fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/webdav/folder/3.jpg</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>225364</oc:fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>
  1. Notice the root folder has fileid 225364 and all files inside it have the same id. That's wrong.
  2. Try to ask for fileid of any of these files, like: curl -u "user:password" -X PROPFIND -H "Content-Type: text/xml" --data-binary "@/tmp/propfind-fileid.xml" "http://localhost/remote.php/webdav/folder/1.jpg" | xmllint --format -. You will get:
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/webdav/folder/1.jpg</d:href>
    <d:propstat>
      <d:prop>
        <oc:fileid>225372</oc:fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>
  1. Notice fileid is correct.

Expected behaviour

When Depth: infinity header supplied, fileid should be file id, not parent folder id.

Server configuration

Operating system: debian jessie

Web server: apache

Database: mysql

PHP version: 7.0

ownCloud version: 10.0.8.5

Updated from an older ownCloud or fresh install: 9.1.x

/settings/integrity/failed: "No errors have been found."

Are you using external storage, if yes which one: local

Are you using encryption: no

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

Activity

  1. ownclouders commented on Apr 22, 2018

    @ownclouders
    Contributor

    GitMate.io thinks possibly related issues are #28341 (Wrong PROPFIND answer with depth infinity requests), #5777 ([webdav] Wrong MOVE requests deletes directory), #234 (Webdav - Wrong filesize for zip files), #28615 (Webdav API to access files by fileid), and #4370 (webdav via gvfs).

  2. PaulAnnekov commented on Apr 22, 2018

    @PaulAnnekov
    Author

    Duplicate of #28341, closing.

  3. lock commented on Jul 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  4. locked as resolved and limited conversation to collaborators on Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions