Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-03-30 12:19:30 +0300
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-03-30 13:23:29 +0300
commitdcd2a6841e9f1f111f74c9f6006c3821bfb12e3d (patch)
tree4a92be480caf2ce4912f46f24c93e68aea511cf9
parentcf4c77e064fd52d891bc842d78431cceb2f34952 (diff)
Fix incorrect if conditions in Viewfix/view-inconsistent-if-conditions
($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 <come.chilliet@nextcloud.com>
-rw-r--r--lib/private/Files/View.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 779e0611591..40109f37184 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1179,7 +1179,7 @@ class View {
throw $e;
}
- if ($result && in_array('delete', $hooks) and $result) {
+ if ($result && in_array('delete', $hooks)) {
$this->removeUpdate($storage, $internalPath);
}
if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') {
@@ -1449,7 +1449,7 @@ class View {
$data = $this->getCacheEntry($storage, $internalPath, $directory);
- if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() && Constants::PERMISSION_READ)) {
+ if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() & Constants::PERMISSION_READ)) {
return [];
}
@@ -1503,7 +1503,7 @@ class View {
$rootEntry = $subCache->get('');
}
- if ($rootEntry && ($rootEntry->getPermissions() && Constants::PERMISSION_READ)) {
+ if ($rootEntry && ($rootEntry->getPermissions() & Constants::PERMISSION_READ)) {
$relativePath = trim(substr($mountPoint, $dirLength), '/');
if ($pos = strpos($relativePath, '/')) {
//mountpoint inside subfolder add size to the correct folder