* @return array an array of metadata of the file
*/
public function getData($path) {
- $permissions = $this->storage->getPermissions($path);
- if (!$permissions & \OCP\PERMISSION_READ) {
- //cant read, nothing we can do
+ $data = $this->storage->getMetaData($path);
+ if (is_null($data)) {
\OCP\Util::writeLog('OC\Files\Cache\Scanner', "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG);
- return null;
}
-
- $data = $this->storage->getMetaData($path);
- $data['permissions'] = $permissions;
-
return $data;
}
* @inheritdoc
*/
public function getMetaData($path) {
+ $permissions = $this->getPermissions($path);
+ if (!$permissions & \OCP\Constants::PERMISSION_READ) {
+ //cant read, nothing we can do
+ return null;
+ }
+
$data = [];
$data['mimetype'] = $this->getMimeType($path);
$data['mtime'] = $this->filemtime($path);
}
$data['etag'] = $this->getETag($path);
$data['storage_mtime'] = $data['mtime'];
+ $data['permissions'] = $this->getPermissions($path);
+
return $data;
}
}
namespace OC\Files\Storage\Wrapper;
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
+use OC\Encryption\File;
+use OC\Files\Filesystem;
use OC\Files\Storage\LocalTempFileTrait;
use OCP\Files\Mount\IMountPoint;
/** @var array */
private $unencryptedSize;
- /** @var \OC\Encryption\File */
+ /** @var File */
private $fileHelper;
/** @var IMountPoint */
* @param \OC\Encryption\Manager $encryptionManager
* @param \OC\Encryption\Util $util
* @param \OC\Log $logger
- * @param \OC\Encryption\File $fileHelper
+ * @param File $fileHelper
* @param string $uid user who perform the read/write operation (null for public access)
*/
public function __construct(
\OC\Encryption\Manager $encryptionManager = null,
\OC\Encryption\Util $util = null,
\OC\Log $logger = null,
- \OC\Encryption\File $fileHelper = null,
+ File $fileHelper = null,
$uid = null
) {
*/
public function getMetaData($path) {
$data = $this->storage->getMetaData($path);
+ if (is_null($data)) {
+ return null;
+ }
$fullPath = $this->getFullPath($path);
if (isset($this->unencryptedSize[$fullPath])) {
- $size = $this->unencryptedSize[$fullPath];
-
$data['encrypted'] = true;
- $data['size'] = $size;
+ $data['size'] = $this->unencryptedSize[$fullPath];
} else {
$info = $this->getCache()->get($path);
if (isset($info['fileid']) && $info['encrypted']) {
* @return string full path including mount point
*/
protected function getFullPath($path) {
- return \OC\Files\Filesystem::normalizePath($this->mountPoint . '/' . $path);
+ return Filesystem::normalizePath($this->mountPoint . '/' . $path);
}
/**