Move ownCloud client condition from Storage to Server
This commit is contained in:
parent
3c6f81c45c
commit
12f5d7cfbd
|
@ -36,6 +36,8 @@ Its original purpose was to serve as a demo and test for the KD2 WebDAV library,
|
||||||
|
|
||||||
### NextCloud/ownCloud features
|
### NextCloud/ownCloud features
|
||||||
|
|
||||||
|
KaraDAV is compatible with ownCloud and NextCloud clients, because on Android there is not much nice WebDAV clients, and on desktop their clients allow for two-way sync, which no other WebDAV client provides.
|
||||||
|
|
||||||
The following ownCloud/NextCloud specific features are supported:
|
The following ownCloud/NextCloud specific features are supported:
|
||||||
|
|
||||||
* [Direct download](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download)
|
* [Direct download](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download)
|
||||||
|
|
|
@ -105,7 +105,9 @@ abstract class AbstractStorage
|
||||||
* @param array $properties List of properties requested by client (see ::properties)
|
* @param array $properties List of properties requested by client (see ::properties)
|
||||||
* @return iterable An array or other iterable (eg. a generator)
|
* @return iterable An array or other iterable (eg. a generator)
|
||||||
* where each item has a key string containing the name of the resource (eg. file name),
|
* where each item has a key string containing the name of the resource (eg. file name),
|
||||||
* and the value being an array of properties, or NULL
|
* and the value being an array of properties, or NULL.
|
||||||
|
*
|
||||||
|
* If the array value IS NULL, then a subsequent call to properties() will be issued for each element.
|
||||||
*/
|
*/
|
||||||
abstract public function list(string $uri, array $properties): iterable;
|
abstract public function list(string $uri, array $properties): iterable;
|
||||||
|
|
||||||
|
|
|
@ -742,6 +742,14 @@ class Server
|
||||||
$alias = $root_namespaces[$ns] ?? null;
|
$alias = $root_namespaces[$ns] ?? null;
|
||||||
$attributes = '';
|
$attributes = '';
|
||||||
|
|
||||||
|
// The ownCloud Android app doesn't like formatted dates, it makes it crash.
|
||||||
|
// so force it to have a timestamp
|
||||||
|
if ($name == 'DAV::creationdate'
|
||||||
|
&& ($value instanceof \DateTimeInterface)
|
||||||
|
&& false !== stripos($_SERVER['HTTP_USER_AGENT'] ?? '', 'owncloud')) {
|
||||||
|
$value = $value->getTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
if ($name == 'DAV::resourcetype' && $value == 'collection') {
|
if ($name == 'DAV::resourcetype' && $value == 'collection') {
|
||||||
$value = '<d:collection />';
|
$value = '<d:collection />';
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace KaraDAV;
|
namespace KaraDAV;
|
||||||
|
|
||||||
use KD2\WebDAV\AbstractStorage;
|
use KD2\WebDAV\AbstractStorage;
|
||||||
use KD2\WebDAV\Server as WebDAV_Server;
|
|
||||||
use KD2\WebDAV\WOPI;
|
use KD2\WebDAV\WOPI;
|
||||||
use KD2\WebDAV\Exception as WebDAV_Exception;
|
use KD2\WebDAV\Exception as WebDAV_Exception;
|
||||||
|
|
||||||
|
@ -130,11 +129,6 @@ class Storage extends AbstractStorage
|
||||||
case 'DAV::lastaccessed':
|
case 'DAV::lastaccessed':
|
||||||
return new \DateTime('@' . fileatime($target));
|
return new \DateTime('@' . fileatime($target));
|
||||||
case 'DAV::creationdate':
|
case 'DAV::creationdate':
|
||||||
// The ownCloud Android app doesn't like formatted dates, it makes it crash.
|
|
||||||
if (false !== stripos($_SERVER['HTTP_USER_AGENT'] ?? '', 'owncloud')) {
|
|
||||||
return filectime($target);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new \DateTime('@' . filectime($target));
|
return new \DateTime('@' . filectime($target));
|
||||||
case WebDAV::PROP_DIGEST_MD5:
|
case WebDAV::PROP_DIGEST_MD5:
|
||||||
if (!is_file($target)) {
|
if (!is_file($target)) {
|
||||||
|
|
Loading…
Reference in a new issue