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 SEARCH not returning owner-id or owner-display-name #12226

Closed
hactar opened this issue Nov 2, 2018 · 5 comments
Closed

WebDav SEARCH not returning owner-id or owner-display-name #12226

hactar opened this issue Nov 2, 2018 · 5 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: dav needs info

Comments

@hactar
Copy link

hactar commented Nov 2, 2018

According to https://docs.nextcloud.com/server/14/developer_manual/client_apis/WebDAV/search.html the owner-display-name or owner-id is selectable, in practice the property is not returned, even if explicitly requested.

Steps to reproduce

Do a SEARCH, like:

## Request
curl -X "SEARCH" "https://SERVERNAME/remote.php/dav" \
     -H 'Content-Type: text/xml' \
     -u 'USERNAME:PASSWORD' \
     -d $'<?xml version="1.0" encoding="UTF-8"?>
<d:searchrequest xmlns:d="DAV:" xmlns:nc="http://nextcloud.org/ns" xmlns:oc="http://owncloud.org/ns">
   <d:basicsearch>
      <d:select>
         <d:prop>
            <d:getlastmodified />
            <d:getetag />
            <d:resourcetype />
            <oc:owner-display-name />
            <oc:owner-id />
            <oc:fileid />
            <oc:id />
            <oc:permissions />
            <oc:size />
            <oc:favorite />
            <nc:is-encrypted />
         </d:prop>
      </d:select>
      <d:from>
         <d:scope>
            <d:href>/files/251f913c-7393-1037-9205-251a47f76a4e</d:href>
            <d:depth>infinity</d:depth>
         </d:scope>
      </d:from>
      <d:where>
         <d:like>
            <d:prop>
               <d:displayname />
            </d:prop>
            <d:literal>%</d:literal>
         </d:like>
      </d:where>
   </d:basicsearch>
</d:searchrequest>'

Expected behaviour

I should get files back, including the owner-display-name.

Actual behaviour

I get files back, but get a HTTP/1.1 404 Not Found for owner-display-name and owner-id property, like here:

<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/251f913c-7393-1037-9205-251a47f76a4e/testtext.txt</d:href>
    <d:propstat>
      <d:prop>
        <d:getlastmodified>Sat, 10 Feb 2018 14:39:04 GMT</d:getlastmodified>
        <d:getetag>"fc564bb08cf08f0378850e86cc33d08c"</d:getetag>
        <d:resourcetype/>
        <oc:fileid>3595</oc:fileid>
        <oc:id>00003595ocap21hxm9u5</oc:id>
        <oc:permissions>RGDNVW</oc:permissions>
        <oc:size>16</oc:size>
        <oc:favorite>0</oc:favorite>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
    <d:propstat>
      <d:prop>
        <oc:owner-display-name/>
        <oc:owner-id/>
        <nc:is-encrypted/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/files/251f913c-7393-1037-9205-251a47f76a4e/testdock.odt</d:href>
    <d:propstat>
      <d:prop>
        <d:getlastmodified>Sat, 10 Feb 2018 14:38:38 GMT</d:getlastmodified>
        <d:getetag>"9069cb941839adc685c5ee65ef2057ff"</d:getetag>
        <d:resourcetype/>
        <oc:fileid>3593</oc:fileid>
        <oc:id>00003593ocap21hxm9u5</oc:id>
        <oc:permissions>RGDNVW</oc:permissions>
        <oc:size>8364</oc:size>
        <oc:favorite>0</oc:favorite>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
    <d:propstat>
      <d:prop>
        <oc:owner-display-name/>
        <oc:owner-id/>
        <nc:is-encrypted/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Server configuration

Tested with Nextcloud docker 14.0.3.

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #3738 (Webdav), #9347 (Webdav Search is not working), #9891 (Master: no webdav search), #9892 (Webdav search: folders with double slash), and #1491 (Changeable display name within contacts).

@hactar
Copy link
Author

hactar commented Nov 4, 2018

I've traced this down to the Folder.php file. (

$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount);
)

All new FileInfo in that file are missing the "owner" parameter.

By changing line 251 to

				$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount,
				 \OC::$server->getUserManager()->get($mount->getStorage()->getOwner($this->path . '/' . $result['path'])));

the issue goes away.

@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@kesselb
Copy link
Contributor

kesselb commented Dec 11, 2019

@hactar Mind to create a pull request? ;)

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Mar 10, 2020
@szaimen
Copy link
Contributor

szaimen commented Jan 9, 2023

Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you!

@szaimen szaimen added needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 1. to develop Accepted and waiting to be taken care of labels Jan 9, 2023
@hactar
Copy link
Author

hactar commented Jan 9, 2023

Sorry but I no longer maintain the project that required this fix, so am unable to test this for you :)

@szaimen szaimen closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: dav needs info
Projects
None yet
Development

No branches or pull requests

6 participants