Skip to content

Commit

Permalink
fix: fix davclient options call (#5584)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Oct 9, 2021
1 parent 3e813c2 commit 9c276aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 0 additions & 6 deletions app/Services/DavClient/Utils/AddressBookGetter.php
Expand Up @@ -116,12 +116,6 @@ private function getAddressBookBaseUri(): string
private function checkOptions()
{
$options = $this->client->options();
if (! empty($options)) {
$options = array_map(function ($option) {
return explode(', ', $option);
}, $options);
$options = Arr::flatten($options);
}

if (! in_array('1', $options) || ! in_array('3', $options) || ! in_array('addressbook', $options)) {
throw new DavServerNotCompliantException('server is not compliant with rfc2518 section 15.1, or rfc6352 section 6.1');
Expand Down
13 changes: 6 additions & 7 deletions app/Services/DavClient/Utils/Dav/DavClient.php
Expand Up @@ -483,16 +483,15 @@ public function options(): array
{
$response = $this->request('OPTIONS');

$dav = Arr::get($response->headers(), 'Dav');
if (! $dav) {
$dav = $response->header('Dav');
if (empty($dav)) {
return [];
}
$davs = explode(', ', $dav);

foreach ($dav as &$v) {
$v = trim($v);
}

return $dav;
return array_map(function ($header) {
return trim($header);
}, $davs);
}

/**
Expand Down

0 comments on commit 9c276aa

Please sign in to comment.