handle not found mounts when cleaning avatars

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-12-11 16:39:44 +01:00
parent 10aa287463
commit 05d2f61a59
No known key found for this signature in database
GPG key ID: CBCA68FBAEBF98C9
2 changed files with 9 additions and 0 deletions

View file

@ -1362,6 +1362,9 @@ class View {
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
$mount = Filesystem::getMountManager()->find($path);
if (!$mount) {
return false;
}
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($path);
if ($storage) {
@ -1411,6 +1414,9 @@ class View {
$path = $this->getAbsolutePath($directory);
$path = Filesystem::normalizePath($path);
$mount = $this->getMount($directory);
if (!$mount) {
return [];
}
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($path);
if ($storage) {

View file

@ -118,6 +118,7 @@ use OCP\Defaults;
use OCA\Theming\Util;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\Files\NotFoundException;
use OCP\ICacheFactory;
use OCP\IDBConnection;
use OCP\IL10N;
@ -1151,6 +1152,8 @@ class Server extends ServerContainer implements IServerContainer {
try {
$avatar = $manager->getAvatar($user->getUID());
$avatar->remove();
} catch (NotFoundException $e) {
// no avatar to remove
} catch (\Exception $e) {
// Ignore exceptions
$logger->info('Could not cleanup avatar of ' . $user->getUID());