From 5586b2db096f64623b4df76da560c48198c573df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 12 Jun 2015 11:58:26 +0200 Subject: [PATCH] Don't use limit on explode to have only 1 code path --- lib/private/files/view.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 492917b915..a206eab54e 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -1788,14 +1788,9 @@ class View { protected function shouldLockFile($path) { $path = Filesystem::normalizePath($path); - if (substr_count($path, '/') >= 3) { + $pathSegments = explode('/', $path); + if (isset($pathSegments[2])) { // E.g.: /username/files/path-to-file - $pathSegments = explode('/', $path, 4); - return $pathSegments[2] === 'files'; - - } else if (substr_count($path, '/') === 2) { - // E.g.: /username/files - $pathSegments = explode('/', $path, 3); return $pathSegments[2] === 'files'; }