Merge pull request #25944 from nextcloud/backport/25659/stable20
[stable20] catch notfound and forbidden exception in smb::getmetadata
This commit is contained in:
commit
4f18ff9815
|
@ -556,7 +556,13 @@ class SMB extends Common implements INotifyStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
$fileInfo = $this->getFileInfo($path);
|
try {
|
||||||
|
$fileInfo = $this->getFileInfo($path);
|
||||||
|
} catch (NotFoundException $e) {
|
||||||
|
return null;
|
||||||
|
} catch (ForbiddenException $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (!$fileInfo) {
|
if (!$fileInfo) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Scanner extends \OC\Files\Cache\Scanner {
|
||||||
* @param int $parentId
|
* @param int $parentId
|
||||||
* @param array | null $cacheData existing data in the cache for the file to be scanned
|
* @param array | null $cacheData existing data in the cache for the file to be scanned
|
||||||
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
||||||
* @return array an array of metadata of the scanned file
|
* @return array | null an array of metadata of the scanned file
|
||||||
*/
|
*/
|
||||||
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
|
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Scanner extends \OC\Files\Cache\Scanner {
|
||||||
*
|
*
|
||||||
* @param string $path path of the file for which to retrieve metadata
|
* @param string $path path of the file for which to retrieve metadata
|
||||||
*
|
*
|
||||||
* @return array an array of metadata of the file
|
* @return array|null an array of metadata of the file
|
||||||
*/
|
*/
|
||||||
public function getData($path) {
|
public function getData($path) {
|
||||||
$data = parent::getData($path);
|
$data = parent::getData($path);
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
||||||
* *
|
* *
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return array an array of metadata of the file
|
* @return array|null an array of metadata of the file
|
||||||
*/
|
*/
|
||||||
protected function getData($path) {
|
protected function getData($path) {
|
||||||
$data = $this->storage->getMetaData($path);
|
$data = $this->storage->getMetaData($path);
|
||||||
|
@ -127,7 +127,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
||||||
* @param array|null|false $cacheData existing data in the cache for the file to be scanned
|
* @param array|null|false $cacheData existing data in the cache for the file to be scanned
|
||||||
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
||||||
* @param null $data the metadata for the file, as returned by the storage
|
* @param null $data the metadata for the file, as returned by the storage
|
||||||
* @return array an array of metadata of the scanned file
|
* @return array|null an array of metadata of the scanned file
|
||||||
* @throws \OCP\Lock\LockedException
|
* @throws \OCP\Lock\LockedException
|
||||||
*/
|
*/
|
||||||
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
|
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
|
||||||
|
@ -322,7 +322,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
||||||
* @param bool $recursive
|
* @param bool $recursive
|
||||||
* @param int $reuse
|
* @param int $reuse
|
||||||
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
||||||
* @return array an array of the meta data of the scanned file or folder
|
* @return array|null an array of the meta data of the scanned file or folder
|
||||||
*/
|
*/
|
||||||
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
|
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
|
||||||
if ($reuse === -1) {
|
if ($reuse === -1) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ interface Storage extends \OCP\Files\Storage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return array
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
public function getMetaData($path);
|
public function getMetaData($path);
|
||||||
|
|
||||||
|
|
|
@ -528,10 +528,6 @@ class Encoding extends Wrapper {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $path
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
return $this->storage->getMetaData($this->findPathToUse($path));
|
return $this->storage->getMetaData($this->findPathToUse($path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,10 +190,6 @@ class Encryption extends Wrapper {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $path
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
$data = $this->storage->getMetaData($path);
|
$data = $this->storage->getMetaData($path);
|
||||||
if (is_null($data)) {
|
if (is_null($data)) {
|
||||||
|
|
|
@ -438,10 +438,6 @@ class Jail extends Wrapper {
|
||||||
return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path));
|
return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $path
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
return $this->getWrapperStorage()->getMetaData($this->getUnjailedPath($path));
|
return $this->getWrapperStorage()->getMetaData($this->getUnjailedPath($path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -575,10 +575,6 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
|
||||||
return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
|
return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $path
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
return $this->getWrapperStorage()->getMetaData($path);
|
return $this->getWrapperStorage()->getMetaData($path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ interface IScanner {
|
||||||
* @param int $parentId
|
* @param int $parentId
|
||||||
* @param array | null $cacheData existing data in the cache for the file to be scanned
|
* @param array | null $cacheData existing data in the cache for the file to be scanned
|
||||||
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
||||||
* @return array an array of metadata of the scanned file
|
* @return array | null an array of metadata of the scanned file
|
||||||
* @throws \OC\ServerNotAvailableException
|
* @throws \OC\ServerNotAvailableException
|
||||||
* @throws \OCP\Lock\LockedException
|
* @throws \OCP\Lock\LockedException
|
||||||
* @since 9.0.0
|
* @since 9.0.0
|
||||||
|
@ -59,7 +59,7 @@ interface IScanner {
|
||||||
* @param bool $recursive
|
* @param bool $recursive
|
||||||
* @param int $reuse
|
* @param int $reuse
|
||||||
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
* @param bool $lock set to false to disable getting an additional read lock during scanning
|
||||||
* @return array an array of the meta data of the scanned file or folder
|
* @return array | null an array of the meta data of the scanned file or folder
|
||||||
* @since 9.0.0
|
* @since 9.0.0
|
||||||
*/
|
*/
|
||||||
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true);
|
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true);
|
||||||
|
|
Loading…
Reference in New Issue