summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-04-14 10:59:24 +0200
committerGitHub <noreply@github.com>2020-04-14 10:59:24 +0200
commit734c1a4649862290868dd5a60b759086006450cc (patch)
tree0546c229865484da6cf0f014110165b4359cd928
parentb6e3512ab5b2d944e10dfc761c1c574601a608ba (diff)
parentab699661ce14bf72343312c7a417309c5806e8ec (diff)
downloadnextcloud-server-734c1a4649862290868dd5a60b759086006450cc.tar.gz
nextcloud-server-734c1a4649862290868dd5a60b759086006450cc.zip
Merge pull request #20334 from nextcloud/backport/20284/stable18
[stable18] Properly catch NoUserException during upload cleanup
-rw-r--r--apps/dav/lib/BackgroundJob/UploadCleanup.php3
-rw-r--r--lib/private/Files/Node/Root.php6
-rw-r--r--lib/public/Files/IRootFolder.php4
3 files changed, 10 insertions, 3 deletions
diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php
index bb8125a01d6..6a346105418 100644
--- a/apps/dav/lib/BackgroundJob/UploadCleanup.php
+++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\DAV\BackgroundJob;
+use OC\User\NoUserException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
@@ -62,7 +63,7 @@ class UploadCleanup extends TimedJob {
$uploads = $userRoot->get('uploads');
/** @var Folder $uploadFolder */
$uploadFolder = $uploads->get($folder);
- } catch (NotFoundException $e) {
+ } catch (NotFoundException|NoUserException $e) {
$this->jobList->remove(self::class, $argument);
return;
}
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 948715aec04..357c22aa45f 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -35,6 +35,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint;
use OC\Hooks\PublicEmitter;
+use OC\User\NoUserException;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -352,7 +353,8 @@ class Root extends Folder implements IRootFolder {
*
* @param string $userId user ID
* @return \OCP\Files\Folder
- * @throws \OC\User\NoUserException
+ * @throws NoUserException
+ * @throws NotPermittedException
*/
public function getUserFolder($userId) {
$userObject = $this->userManager->get($userId);
@@ -367,7 +369,7 @@ class Root extends Folder implements IRootFolder {
'app' => 'files',
]
);
- throw new \OC\User\NoUserException('Backends provided no user object');
+ throw new NoUserException('Backends provided no user object');
}
$userId = $userObject->getUID();
diff --git a/lib/public/Files/IRootFolder.php b/lib/public/Files/IRootFolder.php
index 5304414ae7b..0d568f9045e 100644
--- a/lib/public/Files/IRootFolder.php
+++ b/lib/public/Files/IRootFolder.php
@@ -25,6 +25,7 @@
namespace OCP\Files;
use OC\Hooks\Emitter;
+use OC\User\NoUserException;
/**
* Interface IRootFolder
@@ -39,6 +40,9 @@ interface IRootFolder extends Folder, Emitter {
*
* @param string $userId user ID
* @return \OCP\Files\Folder
+ * @throws NoUserException
+ * @throws NotPermittedException
+ *
* @since 8.2.0
*/
public function getUserFolder($userId);