Bugfix: $result undefined for #79

This commit is contained in:
djmaze 2021-04-12 13:54:07 +02:00
parent 971bd70314
commit bc36b10348

View file

@ -113,9 +113,10 @@ class Client
'Content-Type: application/xml'
));
if (301 == $response->status) {
$location = $result->getRedirectLocation();
// Like: RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
$location = $response->getRedirectLocation();
\trigger_error("Redirect {$url} to {$location}");
$url = \preg_replace('@^(https?:)?//[^/]+/@', '/', $location);
$url = \preg_replace('@^(https?:)?//[^/]+[/$]@', '/', $location);
$parts = \parse_url($this->baseUri);
$url = $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port'])?':' . $parts['port']:'') . $url;
$response = $this->HTTP->doRequest('PROPFIND', $url, $body, array(