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

Missing {DAV:}iscollection property on list content #16267

Closed
JanUrlaub opened this issue Jul 6, 2019 · 6 comments
Closed

Missing {DAV:}iscollection property on list content #16267

JanUrlaub opened this issue Jul 6, 2019 · 6 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug needs info

Comments

@JanUrlaub
Copy link

JanUrlaub commented Jul 6, 2019

Steps to reproduce

  1. Create an Folder with sub folders and containing files in this sub folders
  2. Use webdav framework like flysystem (PHP)
  3. Use flysystem->listContents($path,true);

`

   $client = new Sabre\DAV\Client($webdav_settings);

    $webdavAdapter   = new League\Flysystem\WebDAV\WebDAVAdapter($client,"/remote.php/webdav/");

    $flysystem = new League\Flysystem\Filesystem($webdavAdapter);

    $files=$flysystem->listContents("RootFolder",true);

    print_r($files);die();

`

Expected behaviour

The containing folders should hav the type folder.
... Because flysystem is checking for the property "iscollection" which should be definied, if its an folder.

Actual behaviour

The type is file, because the else path is file. So flysystem dont get recursive into the folder.

Server configuration

Operating system:
Debian 9 (updated)
Web server:
Apache (updated)
Database:
Mysql (updated)
PHP version:
PHP 7.0 (but this also happens on PHP 7.3)
Nextcloud version: (see Nextcloud admin page)
15.0.9 and 16.0.2
Updated from an older Nextcloud/ownCloud or fresh install:
Both updated
Where did you install Nextcloud from:
Nextcloud page

@JanUrlaub JanUrlaub added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jul 6, 2019
@kesselb
Copy link
Contributor

kesselb commented Jul 8, 2019

Do you have any information (like rfc) about this? It looks like "iscollection" belongs to MS-WDVME which is an webdav extension from Microsoft.

https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wdvme/6d81c2e3-9893-4c1d-9e57-4d2345c625f2

@kesselb
Copy link
Contributor

kesselb commented Jul 8, 2019

$response = $this->propfind($path);
if ($response === false) {
return false;
}
$responseType = [];
if (isset($response["{DAV:}resourcetype"])) {
/** @var ResourceType[] $response */
$responseType = $response["{DAV:}resourcetype"]->getValue();
}
return (count($responseType) > 0 and $responseType[0] == "{DAV:}collection") ? 'dir' : 'file';

This is how nextcloud parses the dav response. If there is an element resourcetype and inside another element collection we assume its a directory.

https://github.com/thephpleague/flysystem-webdav/blob/master/src/WebDAVAdapter.php#L403-L406

Hey @frankdejonge, I hope its okay to ping you here. What do you think?

@frankdejonge
Copy link

@kesselb if this works, it's all the same for me! However it seems that the interpretation of this should probably happen at the sabre/dav level instead of here, but I might be off.

@JanUrlaub
Copy link
Author

JanUrlaub commented Jul 9, 2019

Yes https://github.com/thephpleague/flysystem-webdav/issues/53 is the same issue.
I was sure it worked and I have seen the attribute collection before, but I am not sure enogth ;)

I found this RFC. But I am not so familiar with that.
https://tools.ietf.org/html/rfc5323#section-5.13

@JanUrlaub
Copy link
Author

JanUrlaub commented Jul 9, 2019

I have checked the implementation of flysystem.
It sends:
<?xml version="1.0" encoding="UTF-8"?> <d:propfind xmlns:d="DAV:"> <d:prop> <d:displayname/> <d:getcontentlength/> <d:getcontenttype/> <d:getlastmodified/> <d:iscollection/> </d:prop> </d:propfind>

and gets

[200] => Array
(
[{DAV:}getlastmodified] => xxxxxxxxxxxxxxxx
)
[404] => Array
(
[{DAV:}displayname] =>
[{DAV:}getcontentlength] =>
[{DAV:}getcontenttype] =>
[{DAV:}iscollection] =>
)

also on folders

@kesselb
Copy link
Contributor

kesselb commented Jul 11, 2019

thephpleague/flysystem-webdav#57 lets continue there.

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 needs info
Projects
None yet
Development

No branches or pull requests

3 participants