Update dependencies
This commit is contained in:
parent
3641b1d2e1
commit
60acfc6117
|
@ -57,6 +57,8 @@ After you have set up the sync you get a bunch of requests:
|
||||||
|
|
||||||
### Etags are mandatory
|
### Etags are mandatory
|
||||||
|
|
||||||
|
If you don't provide an etag, eg. for a directory, the app will fail to sync with a message about missing data.
|
||||||
|
|
||||||
### Don't use text/xml
|
### Don't use text/xml
|
||||||
|
|
||||||
> PROPFIND reply is not XML formatted
|
> PROPFIND reply is not XML formatted
|
||||||
|
|
|
@ -260,6 +260,18 @@ abstract class NextCloud
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->server->log('NC => %d - %s', $e->getCode(), $e->getMessage());
|
$this->server->log('NC => %d - %s', $e->getCode(), $e->getMessage());
|
||||||
http_response_code($e->getCode());
|
http_response_code($e->getCode());
|
||||||
|
|
||||||
|
if ($route == 'direct') {
|
||||||
|
// Do not return any error message for the direct API endpoint.
|
||||||
|
// If you return anything, the client will consider it is part of the file
|
||||||
|
// and will generate a corrupted file!
|
||||||
|
// so if you return a 20-byte long error message, the client
|
||||||
|
// will do a normal GET on the regular URL, but with 'Range: bytes=20-'!
|
||||||
|
// see https://github.com/nextcloud/desktop/issues/5170
|
||||||
|
header('X-Error: ' . $e->getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode(['error' => $e->getMessage()]);
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +341,7 @@ abstract class NextCloud
|
||||||
// Android app is using "/remote.php/dav/files/user//" as root
|
// Android app is using "/remote.php/dav/files/user//" as root
|
||||||
// so let's alias that as well
|
// so let's alias that as well
|
||||||
// ownCloud Android is requesting just /dav/files/
|
// ownCloud Android is requesting just /dav/files/
|
||||||
if (preg_match('!^' . preg_quote($base_uri, '!') . 'files/(?:[a-z]+/+)?!', $uri, $match)) {
|
if (preg_match('!^' . preg_quote($base_uri, '!') . 'files/(?:[^/]+/+)?!', $uri, $match)) {
|
||||||
$base_uri = $match[0];
|
$base_uri = $match[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Server
|
||||||
table { border-collapse: collapse; }
|
table { border-collapse: collapse; }
|
||||||
th, td { padding: .5em; text-align: left; border: 2px solid #ccc; }
|
th, td { padding: .5em; text-align: left; border: 2px solid #ccc; }
|
||||||
span { font-size: 40px; line-height: 40px; }
|
span { font-size: 40px; line-height: 40px; }
|
||||||
</style>', $this->base_uri);
|
</style>', '/' . ltrim($this->base_uri, '/'));
|
||||||
|
|
||||||
$out .= sprintf('<title>%s</title></head><body><h1>%1$s</h1><table>', htmlspecialchars($uri ? str_replace('/', ' / ', $uri) . ' - Files' : 'Files'));
|
$out .= sprintf('<title>%s</title></head><body><h1>%1$s</h1><table>', htmlspecialchars($uri ? str_replace('/', ' / ', $uri) . ' - Files' : 'Files'));
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ class Server
|
||||||
|
|
||||||
$properties[$url . ':' . $name] = [
|
$properties[$url . ':' . $name] = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'ns_alias' => $found[3] ?: null,
|
'ns_alias' => $found[3] ?? null,
|
||||||
'ns_url' => $url,
|
'ns_url' => $url,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -646,6 +646,10 @@ class Server
|
||||||
// We don't really care about having a correct XML string,
|
// We don't really care about having a correct XML string,
|
||||||
// but we can get better WebDAV compliance if we do
|
// but we can get better WebDAV compliance if we do
|
||||||
if (isset($_SERVER['HTTP_X_LITMUS'])) {
|
if (isset($_SERVER['HTTP_X_LITMUS'])) {
|
||||||
|
if (false !== strpos($body, '<!DOCTYPE ')) {
|
||||||
|
throw new Exception('Invalid XML', 400);
|
||||||
|
}
|
||||||
|
|
||||||
$xml = @simplexml_load_string($body);
|
$xml = @simplexml_load_string($body);
|
||||||
|
|
||||||
if ($e = libxml_get_last_error()) {
|
if ($e = libxml_get_last_error()) {
|
||||||
|
@ -759,6 +763,12 @@ class Server
|
||||||
&& false !== stripos($_SERVER['HTTP_USER_AGENT'] ?? '', 'owncloud')) {
|
&& false !== stripos($_SERVER['HTTP_USER_AGENT'] ?? '', 'owncloud')) {
|
||||||
$value = $value->getTimestamp();
|
$value = $value->getTimestamp();
|
||||||
}
|
}
|
||||||
|
// ownCloud app crashes if mimetype is provided for a directory
|
||||||
|
// https://github.com/owncloud/android/issues/3768
|
||||||
|
elseif ($name == 'DAV::getcontenttype'
|
||||||
|
&& ($item['DAV::resourcetype'] ?? null) == 'collection') {
|
||||||
|
$value = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($name == 'DAV::resourcetype' && $value == 'collection') {
|
if ($name == 'DAV::resourcetype' && $value == 'collection') {
|
||||||
$value = '<d:collection />';
|
$value = '<d:collection />';
|
||||||
|
@ -767,6 +777,9 @@ class Server
|
||||||
$value = '"' . $value . '"';
|
$value = '"' . $value . '"';
|
||||||
}
|
}
|
||||||
elseif ($value instanceof \DateTimeInterface) {
|
elseif ($value instanceof \DateTimeInterface) {
|
||||||
|
// Change value to GMT
|
||||||
|
$value = clone $value;
|
||||||
|
$value->setTimezone(new \DateTimeZone('GMT'));
|
||||||
$value = $value->format(DATE_RFC7231);
|
$value = $value->format(DATE_RFC7231);
|
||||||
}
|
}
|
||||||
elseif (is_array($value)) {
|
elseif (is_array($value)) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Storage extends AbstractStorage
|
||||||
// or https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
|
// or https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
|
||||||
if (ENABLE_XSENDFILE) {
|
if (ENABLE_XSENDFILE) {
|
||||||
header('X-SendFile: ' . $path);
|
header('X-SendFile: ' . $path);
|
||||||
exit;
|
return ['stop' => true];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['path' => $path];
|
return ['path' => $path];
|
||||||
|
|
Loading…
Reference in a new issue