From 085c789b82b08750a94233ed69a922e647a73fb5 Mon Sep 17 00:00:00 2001 From: Janis Streib <janis.streib@kit.edu> Date: Thu, 19 Dec 2024 15:29:13 +0100 Subject: [PATCH] FIX: broken array handling in dbeditor (fixes #775) --- src/components/db-editor/APIObjectDBEditor.vue | 9 +++++---- src/components/db-editor/APIObjectDataEditFieldList.vue | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/db-editor/APIObjectDBEditor.vue b/src/components/db-editor/APIObjectDBEditor.vue index d19e6baf3..042d75e9c 100644 --- a/src/components/db-editor/APIObjectDBEditor.vue +++ b/src/components/db-editor/APIObjectDBEditor.vue @@ -85,12 +85,13 @@ export default { new_params[e[0].split('_null')[0]] = '__NULL' } else { if (e[0] in new_params && this.object_definition.attributes[e[0]].data_type.endsWith('_array')) { - if (!Array.isArray(new_params[e[0]])) { - new_params[e[0]] = [new_params[e[0]]] - } new_params[e[0]].push(e[1]) } else { - new_params[e[0]] = e[1] + if (this.object_definition.attributes[e[0]].data_type.endsWith('_array')) { + new_params[e[0]] = [e[1]] + } else { + new_params[e[0]] = e[1] + } } } } diff --git a/src/components/db-editor/APIObjectDataEditFieldList.vue b/src/components/db-editor/APIObjectDataEditFieldList.vue index 10cc6a776..8fa2577a1 100644 --- a/src/components/db-editor/APIObjectDataEditFieldList.vue +++ b/src/components/db-editor/APIObjectDataEditFieldList.vue @@ -40,7 +40,7 @@ export default { methods: {}, data: function () { return { - true_values: this.attribute_preset + true_values: this.attribute_preset !== undefined ? this.attribute_preset : [] } }, watch: { -- GitLab