mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #38619 from fsamapoor/replace_strpos_calls_in_files_external_app
Refactors "strpos" calls in /apps/files_external
This commit is contained in:
commit
ac57cf9f6b
5 changed files with 9 additions and 9 deletions
|
|
@ -134,7 +134,7 @@ class Create extends Base {
|
|||
|
||||
$config = [];
|
||||
foreach ($configInput as $configOption) {
|
||||
if (!strpos($configOption, '=')) {
|
||||
if (!str_contains($configOption, '=')) {
|
||||
$output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>');
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class FtpConnection {
|
|||
public function nlist(string $path) {
|
||||
$files = @ftp_nlist($this->connection, $path);
|
||||
return array_map(function ($name) {
|
||||
if (strpos($name, '/') !== false) {
|
||||
if (str_contains($name, '/')) {
|
||||
$name = basename($name);
|
||||
}
|
||||
return $name;
|
||||
|
|
@ -122,7 +122,7 @@ class FtpConnection {
|
|||
|
||||
if ($files !== false) {
|
||||
return array_map(function ($file) {
|
||||
if (strpos($file['name'], '/') !== false) {
|
||||
if (str_contains($file['name'], '/')) {
|
||||
$file['name'] = basename($file['name']);
|
||||
}
|
||||
return $file;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag
|
|||
$host = substr($host, 0, $hostSlashPos);
|
||||
}
|
||||
|
||||
if (substr($contextPath, -1) !== '/') {
|
||||
if (!str_ends_with($contextPath, '/')) {
|
||||
$contextPath .= '/';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
*/
|
||||
private function splitHost($host) {
|
||||
$input = $host;
|
||||
if (strpos($host, '://') === false) {
|
||||
if (!str_contains($host, '://')) {
|
||||
// add a protocol to fix parse_url behavior with ipv6
|
||||
$host = 'http://' . $host;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ class SMB extends Common implements INotifyStorage {
|
|||
}
|
||||
|
||||
private function splitUser($user) {
|
||||
if (strpos($user, '/')) {
|
||||
if (str_contains($user, '/')) {
|
||||
return explode('/', $user, 2);
|
||||
} elseif (strpos($user, '\\')) {
|
||||
} elseif (str_contains($user, '\\')) {
|
||||
return explode('\\', $user);
|
||||
} else {
|
||||
return [null, $user];
|
||||
}
|
||||
|
||||
return [null, $user];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue