Skip to content

Commit 487e06b

Browse files
committed
Fix incorrect if conditions in View
($something->getPermissions() && Constants::PERMISSION_READ) does not make sense as PERMISSION_READ contant is 1 this will always evaluate to true. getPersmissions is returning an int which is a bitwise combination as documented in the interface, so it should be used with bit operators. Signed-off-by: Côme Chilliet <[email protected]>
1 parent c17e72e commit 487e06b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/private/Files/View.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ private function basicOperation($operation, $path, $hooks = [], $extraParam = nu
11791179
throw $e;
11801180
}
11811181

1182-
if ($result && in_array('delete', $hooks) and $result) {
1182+
if ($result && in_array('delete', $hooks)) {
11831183
$this->removeUpdate($storage, $internalPath);
11841184
}
11851185
if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') {
@@ -1453,7 +1453,7 @@ public function getDirectoryContent($directory, $mimetype_filter = '') {
14531453

14541454
$data = $this->getCacheEntry($storage, $internalPath, $directory);
14551455

1456-
if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() && Constants::PERMISSION_READ)) {
1456+
if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() & Constants::PERMISSION_READ)) {
14571457
return [];
14581458
}
14591459

@@ -1507,7 +1507,7 @@ public function getDirectoryContent($directory, $mimetype_filter = '') {
15071507
$rootEntry = $subCache->get('');
15081508
}
15091509

1510-
if ($rootEntry && ($rootEntry->getPermissions() && Constants::PERMISSION_READ)) {
1510+
if ($rootEntry && ($rootEntry->getPermissions() & Constants::PERMISSION_READ)) {
15111511
$relativePath = trim(substr($mountPoint, $dirLength), '/');
15121512
if ($pos = strpos($relativePath, '/')) {
15131513
//mountpoint inside subfolder add size to the correct folder

0 commit comments

Comments
 (0)