if ($pathSplit[2] == 'files' && $this->view->file_exists($path) && $this->isEncryptedPath($path)) {
if (isset($pathSplit[2]) &&$pathSplit[2] === 'files' && $this->view->file_exists($path) && $this->isEncryptedPath($path)) {
// get the size from filesystem
$fullPath = $this->view->getLocalFile($path);
@ -665,7 +665,7 @@ class Util {
$trimmed = ltrim($path, '/');
$split = explode('/', $trimmed);
if ($split[2] == "Shared") {
if (isset($split[2]) && $split[2] === 'Shared') {
return true;
@ -871,8 +871,8 @@ class Util {
// Check that the user is encryption capable, or is the
// public system user 'ownCloud' (for public shares)
if (
$user == $this->publicShareKeyId
or $user == $this->recoveryKeyId
$user === $this->publicShareKeyId
or $user === $this->recoveryKeyId
or $util->ready()
) {
@ -920,7 +920,7 @@ class Util {
// We need to decrypt the keyfile
// Has the file been shared yet?
if (
$this->userId == $fileOwner
$this->userId === $fileOwner
&& !Keymanager::getShareKey($this->view, $this->userId, $filePath) // NOTE: we can't use isShared() here because it's a post share hook so it always returns true