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

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

Closed
PaulAnnekov opened this issue Apr 22, 2018 · 3 comments
Closed

Comments

@PaulAnnekov
Copy link

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

@ownclouders
Copy link
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).

@PaulAnnekov
Copy link
Author

Duplicate of #28341, closing.

@lock
Copy link

lock bot commented Jul 30, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants