From 6ab55ebcb758103841463aec404f38aa424a53ef Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Thu, 12 Aug 2021 16:58:34 +0000 Subject: Fix error while importing without workspaces (#1776) fixes #1773 --- CHANGELOG.md | 3 ++- src/internal-server/app/Controllers/Http/UserController.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb42f4433..e043ac1af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ ### Bug Fixes - Fix startup crash for Ferdi v5.6.1-nightly.23 💖 @vraravam -- Fixed the sidebar context menu for toggling dark mode. 💖 @vraravam +- Fix the sidebar context menu for toggling dark mode. 💖 @vraravam +- Fix error while importing ferdi data (#1776) 💖 @vraravam ### Internal diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index 88c0deade..a3ad736fa 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js @@ -346,7 +346,9 @@ class UserController { workspaceId = uuid(); } while ((await Workspace.query().where('workspaceId', workspaceId).fetch()).rows.length > 0); // eslint-disable-line no-await-in-loop - const services = workspace.services.map((service) => serviceIdTranslation[service]); + const services = (workspace.services && typeof (workspace.services) === 'object') ? + workspace.services.map((service) => serviceIdTranslation[service]) : + []; await Workspace.create({ // eslint-disable-line no-await-in-loop workspaceId, -- cgit v1.2.3-54-g00ecf