Skip to content

Commit 088fac5

Browse files
committed
fix: Catch Exception about unknown keys
If the key is not in the lexicon and was never set it does not have a type yet and that’s fine. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 7853636 commit 088fac5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/Service/UserMigrationService.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use OCP\AppFramework\Db\DoesNotExistException;
2222
use OCP\BackgroundJob\IJobList;
2323
use OCP\Cache\CappedMemoryCache;
24+
use OCP\Config\Exceptions\UnknownKeyException;
2425
use OCP\Config\IUserConfig;
2526
use OCP\Config\ValueType;
2627
use OCP\Files\File;
@@ -326,7 +327,12 @@ protected function importAppsSettings(IUser $user,
326327
$userId = $user->getUID();
327328
foreach ($data as $app => $values) {
328329
foreach ($values as $key => $value) {
329-
$type = $userConfig->getValueType($userId, $app, $key);
330+
try {
331+
$type = $userConfig->getValueType($userId, $app, $key);
332+
} catch (UnknownKeyException) {
333+
/** If type is unknown, default to mixed */
334+
$type = ValueType::MIXED;
335+
}
330336
/** @psalm-suppress UndefinedClass ValueType only exists in 32 and higher, but in this if branch we know it exists */
331337
switch ($type) {
332338
default:

0 commit comments

Comments
 (0)