Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apps/dav/lib/CalDAV/WebcalCaching/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public function __construct(
) {
}

/**
* look for ics feeds hosted on O365 servers. These can be picky about UA string
*/
private static function isO365Url($url) {
$host = parse_url($url, PHP_URL_HOST);
return $host === 'outlook.office365.com';
}

Comment thread
st3iny marked this conversation as resolved.
Outdated
/**
* gets webcal feed from remote server
*/
Expand All @@ -34,14 +42,22 @@ public function queryWebcalFeed(array $subscription): ?string {
return null;
}

// calendar/#7234 - ICS feeds hosted on O365 can return HTTP 500 when the UA string isn't satisfactory..
$uaString = 'Nextcloud Webcal Service';
if (Connection::isO365Url($url)) {
Comment thread
st3iny marked this conversation as resolved.
Outdated
// 2025/08/20 - the required format/values here are not documented; this string based on research
// from: https://github.com/bitfireAT/icsx5/discussions/654#discussioncomment-14158051
$uaString = 'NextCloud (Android 16) like Chrome/30';
Comment thread
bmajik marked this conversation as resolved.
Outdated
}

$allowLocalAccess = $this->config->getValueString('dav', 'webcalAllowLocalAccess', 'no');

$params = [
'nextcloud' => [
'allow_local_address' => $allowLocalAccess === 'yes',
],
RequestOptions::HEADERS => [
'User-Agent' => 'Nextcloud Webcal Service',
'User-Agent' => $uaString,
'Accept' => 'text/calendar, application/calendar+json, application/calendar+xml',
],
];
Expand Down
Loading