From 9b57063572678261d9bb2b03a32d2d8e55693f1c Mon Sep 17 00:00:00 2001 From: axolotle Date: Tue, 1 Mar 2022 15:49:10 +0100 Subject: [PATCH] remove edge case arg injection in formatYunohostArguments --- app/src/helpers/yunohostArguments.js | 11 +---------- app/src/views/app/AppInstall.vue | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/helpers/yunohostArguments.js b/app/src/helpers/yunohostArguments.js index e5b01202..97230508 100644 --- a/app/src/helpers/yunohostArguments.js +++ b/app/src/helpers/yunohostArguments.js @@ -259,21 +259,12 @@ export function formatYunoHostArgument (arg) { * @param {String} name - (temp) an app name to build a label field in case of manifest install args * @return {Object} an object containing all parsed values to be used in vue views. */ -export function formatYunoHostArguments (args, name = null) { +export function formatYunoHostArguments (args) { const form = {} const fields = {} const validations = {} const errors = {} - // FIXME yunohost should add the label field by default - if (name) { - args.unshift({ - ask: i18n.t('label_for_manifestname', { name }), - default: name, - name: 'label' - }) - } - for (const arg of args) { const { value, field, validation, error } = formatYunoHostArgument(arg) fields[arg.name] = field diff --git a/app/src/views/app/AppInstall.vue b/app/src/views/app/AppInstall.vue index db0a27b6..dc505a46 100644 --- a/app/src/views/app/AppInstall.vue +++ b/app/src/views/app/AppInstall.vue @@ -92,10 +92,19 @@ export default { manifest.multi_instance = this.$i18n.t(manifest.multi_instance ? 'yes' : 'no') this.infos = Object.fromEntries(infosKeys.map(key => [key, manifest[key]])) - const { form, fields, validations, errors } = formatYunoHostArguments( - manifest.arguments.install, - manifest.name - ) + // FIXME yunohost should add the label field by default + manifest.arguments.install.unshift({ + ask: this.$t('label_for_manifestname', { name: manifest.name }), + default: manifest.name, + name: 'label' + }) + + const { + form, + fields, + validations, + errors + } = formatYunoHostArguments(manifest.arguments.install) this.fields = fields this.form = form