aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector
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/Connector
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/Connector')
-rw-r--r--apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/CachingTree.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php2
4 files changed, 4 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
index 6c3600fa5eb..d8be0c20dc8 100644
--- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
@@ -54,7 +54,7 @@ class AnonymousOptionsPlugin extends ServerPlugin {
* @return bool
*/
public function isRequestInRoot($path) {
- return $path === '' || (is_string($path) && strpos($path, '/') === false);
+ return $path === '' || (is_string($path) && !str_contains($path, '/'));
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php
index 81ffd47a977..b1bccce3620 100644
--- a/apps/dav/lib/Connector/Sabre/CachingTree.php
+++ b/apps/dav/lib/Connector/Sabre/CachingTree.php
@@ -46,7 +46,7 @@ class CachingTree extends Tree {
$path = trim($path, '/');
foreach ($this->cache as $nodePath => $node) {
$nodePath = (string) $nodePath;
- if ('' === $path || $nodePath == $path || 0 === strpos($nodePath, $path.'/')) {
+ if ('' === $path || $nodePath == $path || str_starts_with($nodePath, $path . '/')) {
unset($this->cache[$nodePath]);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index b1f1da6f63d..823eafe8fdb 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -487,7 +487,7 @@ class Principal implements BackendInterface {
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}
- if (strpos($uri, 'mailto:') === 0) {
+ if (str_starts_with($uri, 'mailto:')) {
if ($principalPrefix === 'principals/users') {
$users = $this->userManager->getByEmail(substr($uri, 7));
if (count($users) !== 1) {
diff --git a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
index d0251b2755f..0c274d807a0 100644
--- a/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/PropfindCompressionPlugin.php
@@ -61,7 +61,7 @@ class PropfindCompressionPlugin extends ServerPlugin {
return $response;
}
- if (strpos($header, 'gzip') !== false) {
+ if (str_contains($header, 'gzip')) {
$body = $response->getBody();
if (is_string($body)) {
$response->setHeader('Content-Encoding', 'gzip');