Merge pull request #39214 from shdehnavi/replace_substr_calls_in_dav_app

pull/39366/merge
John Molakvoæ 3 months ago committed by GitHub
commit b91fb12258
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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);
}

@ -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;

@ -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;
}
}

@ -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);
}

@ -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) {

@ -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',

@ -1134,7 +1134,7 @@ class FileTest extends TestCase {
$realPath = $storage->getSourcePath($internalPath);
$dh = opendir($realPath);
while (($file = readdir($dh)) !== false) {
if (substr($file, strlen($file) - 5, 5) === '.part') {
if (str_ends_with($file, '.part')) {
$files[] = $file;
}
}

Loading…
Cancel
Save