}
} catch (ConnectException $e) {
$this->throwUnavailable($e);
+ } catch (NotFoundException $e) {
+ throw new \OCP\Files\NotFoundException($e->getMessage(), 0, $e);
} catch (ForbiddenException $e) {
// with php-smbclient, this exception is thrown when the provided password is invalid.
// Possible is also ForbiddenException with a different error code, so we check it.
if ($e->getCode() === 1) {
$this->throwUnavailable($e);
}
- throw $e;
+ throw new \OCP\Files\ForbiddenException($e->getMessage(), false, $e);
}
}
} catch (ConnectException $e) {
$this->logger->logException($e, ['message' => 'Error while getting folder content']);
throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e);
+ } catch (NotFoundException $e) {
+ throw new \OCP\Files\NotFoundException($e->getMessage(), 0, $e);
}
}
$result = $this->formatInfo($this->getFileInfo($path));
} catch (ForbiddenException $e) {
return false;
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (TimedOutException $e) {
if ($retry) {
public function getMetaData($path) {
try {
$fileInfo = $this->getFileInfo($path);
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return null;
} catch (ForbiddenException $e) {
return null;
public function filetype($path) {
try {
return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file';
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
try {
$this->getFileInfo($path);
return true;
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
try {
$info = $this->getFileInfo($path);
return $this->showHidden || !$info->isHidden();
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
// following windows behaviour for read-only folders: they can be written into
// (https://support.microsoft.com/en-us/kb/326549 - "cause" section)
return ($this->showHidden || !$info->isHidden()) && (!$info->isReadOnly() || $info->isDirectory());
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
try {
$info = $this->getFileInfo($path);
return ($this->showHidden || !$info->isHidden()) && !$info->isReadOnly();
- } catch (NotFoundException $e) {
+ } catch (\OCP\Files\NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
public function test() {
try {
return parent::test();
+ } catch (StorageAuthException $e) {
+ return false;
+ } catch (ForbiddenException $e) {
+ return false;
} catch (Exception $e) {
$this->logger->logException($e);
return false;
use Doctrine\DBAL\Exception;
use OCP\Files\Cache\IScanner;
use OCP\Files\ForbiddenException;
+use OCP\Files\NotFoundException;
use OCP\Files\Storage\IReliableEtagStorage;
use OCP\Lock\ILockingProvider;
use OC\Files\Storage\Wrapper\Encoding;
$newData['parent'] = $parentId;
$data['fileid'] = $this->addToCache($file, $newData, $fileId);
}
-
+
$data['oldSize'] = ($cacheData && isset($cacheData['size'])) ? $cacheData['size'] : 0;
if ($cacheData && isset($cacheData['encrypted'])) {
}
}
try {
- $data = $this->scanFile($path, $reuse, -1, null, $lock);
- if ($data && $data['mimetype'] === 'httpd/unix-directory') {
- $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data);
- $data['size'] = $size;
+ try {
+ $data = $this->scanFile($path, $reuse, -1, null, $lock);
+ if ($data && $data['mimetype'] === 'httpd/unix-directory') {
+ $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data);
+ $data['size'] = $size;
+ }
+ } catch (NotFoundException $e) {
+ $this->removeFromCache($path);
+ return null;
}
} finally {
if ($lock) {