aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichaIng <micha@dietpi.com>2024-06-24 17:52:22 +0200
committerMichaIng <micha@dietpi.com>2024-06-24 17:52:22 +0200
commitea994fe8fb093a7f33967d3380a67645353475dd (patch)
treeee67f58f3d64534cbf8b1af11f7a401f20667fc4
parent879eaa7681b83efb1ed7de2ec8abb6ac3c62ccdd (diff)
downloadnextcloud-server-ea994fe8fb093a7f33967d3380a67645353475dd.tar.gz
nextcloud-server-ea994fe8fb093a7f33967d3380a67645353475dd.zip
fix(settings): make trailing slash for caldav/carddav redirects optional
#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>
-rw-r--r--apps/settings/lib/SetupChecks/WellKnownUrls.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/settings/lib/SetupChecks/WellKnownUrls.php b/apps/settings/lib/SetupChecks/WellKnownUrls.php
index d66fde3abee..2b5481d16ff 100644
--- a/apps/settings/lib/SetupChecks/WellKnownUrls.php
+++ b/apps/settings/lib/SetupChecks/WellKnownUrls.php
@@ -63,7 +63,7 @@ class WellKnownUrls implements ISetupCheck {
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