summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/DAV
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2023-09-17 10:14:20 +0200
committerGitHub <noreply@github.com>2023-09-17 10:14:20 +0200
commit9627176a23e274dd9dbe8bfc481e3882f23d6f50 (patch)
treec2d2cd35ab778dd010a0ebdf5aca035819ef609f /apps/dav/lib/DAV
parent16e584ce6cac844d15adcf75692a6f5ab3fbd698 (diff)
parentbbfe2fb821f00713f46fd896a41dfc62cc02c31a (diff)
downloadnextcloud-server-9627176a23e274dd9dbe8bfc481e3882f23d6f50.tar.gz
nextcloud-server-9627176a23e274dd9dbe8bfc481e3882f23d6f50.zip
Merge pull request #38610 from fsamapoor/replace_strpos_calls_in_dav_app
Refactors "strpos" calls in /apps/dav
Diffstat (limited to 'apps/dav/lib/DAV')
-rw-r--r--apps/dav/lib/DAV/GroupPrincipalBackend.php2
-rw-r--r--apps/dav/lib/DAV/PublicAuth.php2
-rw-r--r--apps/dav/lib/DAV/Sharing/Plugin.php4
3 files changed, 4 insertions, 4 deletions
diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php
index f1f15fd61a6..9acc7c4b05b 100644
--- a/apps/dav/lib/DAV/GroupPrincipalBackend.php
+++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php
@@ -288,7 +288,7 @@ class GroupPrincipalBackend implements BackendInterface {
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}
- if (strpos($uri, 'principal:principals/groups/') === 0) {
+ if (str_starts_with($uri, 'principal:principals/groups/')) {
$name = urlencode(substr($uri, 28));
if ($restrictGroups !== false && !\in_array($name, $restrictGroups, true)) {
return null;
diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php
index 83874ab0d4d..3ba8bb2f3c5 100644
--- a/apps/dav/lib/DAV/PublicAuth.php
+++ b/apps/dav/lib/DAV/PublicAuth.php
@@ -86,7 +86,7 @@ class PublicAuth implements BackendInterface {
private function isRequestPublic(RequestInterface $request) {
$url = $request->getPath();
$matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
- return strpos($url, $publicUrl, 0) === 0;
+ return str_starts_with($url, $publicUrl);
});
return !empty($matchingUrls);
}
diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php
index 8ddcb664fd5..c7d8691ab06 100644
--- a/apps/dav/lib/DAV/Sharing/Plugin.php
+++ b/apps/dav/lib/DAV/Sharing/Plugin.php
@@ -127,8 +127,8 @@ class Plugin extends ServerPlugin {
$path = $request->getPath();
// Only handling xml
- $contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
+ $contentType = (string) $request->getHeader('Content-Type');
+ if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) {
return;
}