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

Make detection of directories compliant with rfc4918 #57

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.9 - xxx

* Made detection of directories compliant with rfc4918 (#53).

## 1.0.8 - 2019-07-08

* Made some properties private to allow them to be overwritten so other types of WebDAV servers can be supported (#51).
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is a Flysystem adapter for the WebDAV.
composer require league/flysystem-webdav
```

# Bootstrap
## Bootstrap

``` php
<?php
Expand Down
12 changes: 12 additions & 0 deletions src/WebDAVAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Sabre\DAV\Client;
use Sabre\DAV\Exception;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Xml\Property\ResourceType;
use Sabre\HTTP\HttpException;

class WebDAVAdapter extends AbstractAdapter
Expand All @@ -28,6 +29,7 @@ class WebDAVAdapter extends AbstractAdapter
'{DAV:}getcontenttype',
'{DAV:}getlastmodified',
'{DAV:}iscollection',
'{DAV:}resourcetype',
];

/**
Expand Down Expand Up @@ -400,8 +402,18 @@ protected function normalizeObject(array $object, $path)
return $result;
}

/**
* @param array $object
* @return bool
*/
protected function isDirectory(array $object)
{
if (isset($object['{DAV:}resourcetype'])) {
/** @var ResourceType $resourceType */
$resourceType = $object['{DAV:}resourcetype'];
return $resourceType->is('{DAV:}collection');
}

return isset($object['{DAV:}iscollection']) && $object['{DAV:}iscollection'] === '1';
kesselb marked this conversation as resolved.
Show resolved Hide resolved
}
}