Skip to content

Commit 01c6095

Browse files
authored
Merge pull request #54575 from nextcloud/fix/outlook-user-agent
fix: use appropriate user agent string when syncing Outlook calendar subscriptions
2 parents e0baf69 + 4d770f1 commit 01c6095

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/dav/lib/CalDAV/WebcalCaching/Connection.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,24 @@ public function queryWebcalFeed(array $subscription): ?string {
3434
return null;
3535
}
3636

37+
// ICS feeds hosted on O365 can return HTTP 500 when the UA string isn't satisfactory
38+
// Ref https://github.com/nextcloud/calendar/issues/7234
39+
$uaString = 'Nextcloud Webcal Service';
40+
if (parse_url($url, PHP_URL_HOST) === 'outlook.office365.com') {
41+
// The required format/values here are not documented.
42+
// Instead, this string based on research.
43+
// Ref https://github.com/bitfireAT/icsx5/discussions/654#discussioncomment-14158051
44+
$uaString = 'Nextcloud (Linux) Chrome/66';
45+
}
46+
3747
$allowLocalAccess = $this->config->getValueString('dav', 'webcalAllowLocalAccess', 'no');
3848

3949
$params = [
4050
'nextcloud' => [
4151
'allow_local_address' => $allowLocalAccess === 'yes',
4252
],
4353
RequestOptions::HEADERS => [
44-
'User-Agent' => 'Nextcloud Webcal Service',
54+
'User-Agent' => $uaString,
4555
'Accept' => 'text/calendar, application/calendar+json, application/calendar+xml',
4656
],
4757
];

0 commit comments

Comments
 (0)