Skip to content

Commit

Permalink
fix(settings): make trailing slash for caldav/carddav redirects optional
Browse files Browse the repository at this point in the history
#43939 moved the CalDAV/CardDAV redirect checks from the frontend to a new backend API.

Since the backend does not send an authentication header, checking for the expected response code 207 of the DAV endpoint does not work anymore, hence the URL of the last redirect is checked instead.

This URL is expected to contain a trailing slash, which was not required before, since the DAV endpoint works properly without it (when authenticated).

While a trailing slash in the redirect does no harm, it causes many setups to throw an admin panel warning, while in fact the redirects work properly. Furthermore, the proposed "/.well-known/carddav" => "/remote.php/dav/" redirect leads to double slashes, when doing a request to "/.well-known/carddav/", which seems more wrong then right.

This change makes the trailing slash optional, hence old and adjusted setups won't throw the warning anymore, and the DAV endpoint works well in both cases.

Signed-off-by: MichaIng <micha@dietpi.com>
  • Loading branch information
MichaIng authored and backportbot[bot] committed Jun 25, 2024
1 parent 6956100 commit a135322
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/settings/lib/SetupChecks/WellKnownUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function run(): SetupResult {
if (!$works && $response->getStatusCode() === 401) {
$redirectHops = explode(',', $response->getHeader('X-Guzzle-Redirect-History'));
$effectiveUri = end($redirectHops);
$works = str_ends_with($effectiveUri, '/remote.php/dav/');
$works = str_ends_with(rtrim($effectiveUri, '/'), '/remote.php/dav');
}
}
// Skip the other requests if one works
Expand Down

0 comments on commit a135322

Please sign in to comment.