diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php b/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php index f26c54406..4db7b64bf 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php @@ -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(