summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-12 11:58:26 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-12 11:58:26 +0200
commit5586b2db096f64623b4df76da560c48198c573df (patch)
tree3d0ce94890a57d6e369b6cb04566b9bf5759a143 /lib/private/files
parenta7d2b3b9ae27ba55ef08e16a2ae1f485120cdcdb (diff)
downloadnextcloud-server-5586b2db096f64623b4df76da560c48198c573df.tar.gz
nextcloud-server-5586b2db096f64623b4df76da560c48198c573df.zip
Don't use limit on explode to have only 1 code path
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/view.php9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 492917b9159..a206eab54e4 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';
}