diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-02-23 21:29:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 21:29:15 +0100 |
commit | b91fb12258b8626763c587733b656d1960fb4349 (patch) | |
tree | 54220cba76909bdea525ef65f01baf256aea982d /apps/dav/lib | |
parent | 3cc50790bc9883f8637a916132c1b4322527d59e (diff) | |
parent | 7bf31df0bc340872a7fb0ce1eb8d11d036189166 (diff) | |
download | nextcloud-server-b91fb12258b8626763c587733b656d1960fb4349.tar.gz nextcloud-server-b91fb12258b8626763c587733b656d1960fb4349.zip |
Merge pull request #39214 from shdehnavi/replace_substr_calls_in_dav_app
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/BulkUpload/MultipartRequestParser.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/BirthdayService.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Node.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/DAV/CustomPropertiesBackend.php | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php index 2541ea8f333..7c977b42ccb 100644 --- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php +++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php @@ -82,7 +82,7 @@ class MultipartRequestParser { $boundaryValue = trim($boundaryValue); // Remove potential quotes around boundary value. - if (substr($boundaryValue, 0, 1) === '"' && substr($boundaryValue, -1) === '"') { + if (str_starts_with($boundaryValue, '"') && str_ends_with($boundaryValue, '"')) { $boundaryValue = substr($boundaryValue, 1, -1); } diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 95176283f11..5d1d55879ca 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -419,7 +419,7 @@ class BirthdayService { * @return string|null */ private function principalToUserId(string $userPrincipal):?string { - if (substr($userPrincipal, 0, 17) === 'principals/users/') { + if (str_starts_with($userPrincipal, 'principals/users/')) { return substr($userPrincipal, 17); } return null; diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php index b61e9dc0c39..c63b1cf50f2 100644 --- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php @@ -108,7 +108,7 @@ class FakeLockerPlugin extends ServerPlugin { if (isset($fileCondition['tokens'])) { foreach ($fileCondition['tokens'] as &$token) { if (isset($token['token'])) { - if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { + if (str_starts_with($token['token'], 'opaquelocktoken:')) { $token['validToken'] = true; } } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index c9407b12786..5237064b46f 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -303,7 +303,7 @@ abstract class Node implements \Sabre\DAV\INode { $mountpoint = $this->info->getMountPoint(); if (!($mountpoint instanceof MoveableMount)) { $mountpointpath = $mountpoint->getMountPoint(); - if (substr($mountpointpath, -1) === '/') { + if (str_ends_with($mountpointpath, '/')) { $mountpointpath = substr($mountpointpath, 0, -1); } diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index df1de17fe20..9d9cfbe43cb 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -505,7 +505,7 @@ class Principal implements BackendInterface { return $this->principalPrefix . '/' . $user->getUID(); } } - if (substr($uri, 0, 10) === 'principal:') { + if (str_starts_with($uri, 'principal:')) { $principal = substr($uri, 10); $principal = $this->getPrincipalByPath($principal); if ($principal !== null) { diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index 311fe0ea561..e76a71aec63 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -166,7 +166,7 @@ class CustomPropertiesBackend implements BackendInterface { // substr of calendars/ => path is inside the CalDAV component // two '/' => this a calendar (no calendar-home nor calendar object) - if (substr($path, 0, 10) === 'calendars/' && substr_count($path, '/') === 2) { + if (str_starts_with($path, 'calendars/') && substr_count($path, '/') === 2) { $allRequestedProps = $propFind->getRequestedProperties(); $customPropertiesForShares = [ '{DAV:}displayname', |