mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Merge pull request #38620 from fsamapoor/replace_strpos_calls_in_files_sharing_app
Refactors "strpos" calls in /apps/files_sharing
This commit is contained in:
commit
dea2f7dd42
4 changed files with 4 additions and 4 deletions
|
|
@ -129,7 +129,7 @@ class ExternalSharesController extends Controller {
|
|||
* @return DataResponse
|
||||
*/
|
||||
public function testRemote($remote) {
|
||||
if (strpos($remote, '#') !== false || strpos($remote, '?') !== false || strpos($remote, ';') !== false) {
|
||||
if (str_contains($remote, '#') || str_contains($remote, '?') || str_contains($remote, ';')) {
|
||||
return new DataResponse(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1841,7 +1841,7 @@ class ShareAPIController extends OCSController {
|
|||
|
||||
if ($share->getShareType() === IShare::TYPE_CIRCLE && \OC::$server->getAppManager()->isEnabledForUser('circles')
|
||||
&& class_exists('\OCA\Circles\Api\v1\Circles')) {
|
||||
$hasCircleId = (substr($share->getSharedWith(), -1) === ']');
|
||||
$hasCircleId = (str_ends_with($share->getSharedWith(), ']'));
|
||||
$shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0);
|
||||
$shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' '));
|
||||
if ($shareWithLength === false) {
|
||||
|
|
|
|||
2
apps/files_sharing/lib/External/Storage.php
vendored
2
apps/files_sharing/lib/External/Storage.php
vendored
|
|
@ -78,7 +78,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage,
|
|||
$discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
|
||||
|
||||
[$protocol, $remote] = explode('://', $this->cloudId->getRemote());
|
||||
if (strpos($remote, '/')) {
|
||||
if (str_contains($remote, '/')) {
|
||||
[$host, $root] = explode('/', $remote, 2);
|
||||
} else {
|
||||
$host = $remote;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
|||
<?php else: ?>
|
||||
<!-- preview frame to open file in with viewer -->
|
||||
<div id="imgframe"></div>
|
||||
<?php if (isset($_['mimetype']) && strpos($_['mimetype'], 'image') === 0) { ?>
|
||||
<?php if (isset($_['mimetype']) && str_starts_with($_['mimetype'], 'image')) { ?>
|
||||
<div class="directDownload">
|
||||
<div>
|
||||
<?php p($_['filename'])?> (<?php p($_['fileSize']) ?>)
|
||||
|
|
|
|||
Loading…
Reference in a new issue