]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show warning when invalid user was passed
authorVincent Petry <pvince81@owncloud.com>
Fri, 14 Nov 2014 11:45:36 +0000 (12:45 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 20 Nov 2014 12:46:19 +0000 (13:46 +0100)
Sometimes there are bugs that cause setupFS() to be called for
non-existing users. Instead of failing hard and breaking the instance,
this fix simply logs a warning.

Backport c941c3fa5139ba4f122d4f40d9c9db5e50f8bcb7 from master

apps/files_external/lib/config.php

index 9e58b1d54f78663d46c81bbec5c4ee4c567bf69f..717426c0e019c6f417b06eaa402c56ee7325e5c9 100644 (file)
@@ -121,6 +121,14 @@ class OC_Mount_Config {
 
                if ($data['user']) {
                        $user = \OC::$server->getUserManager()->get($data['user']);
+                       if (!$user) {
+                               \OC_Log::write(
+                                       'files_external',
+                                       'Cannot init external mount points for non-existant user "' . $data['user'] . '".',
+                                       \OC_Log::WARN
+                               );
+                               return;
+                       }
                        $userView = new \OC\Files\View('/' . $user->getUID() . '/files');
                        $changePropagator = new \OC\Files\Cache\ChangePropagator($userView);
                        $etagPropagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, \OC::$server->getConfig());