From a760246ada0bda5d390e97e156fbaf015bbd5bfe Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 19 Oct 2020 09:31:00 +0200 Subject: [PATCH] fix: allow `/` char in name and location #790 (#796) --- src/components/ControlPanel.vue | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/ControlPanel.vue b/src/components/ControlPanel.vue index 059751b0c5d..6304edd3238 100644 --- a/src/components/ControlPanel.vue +++ b/src/components/ControlPanel.vue @@ -679,20 +679,10 @@ export default { val || this.closeDialog() }, newName (val) { - var match = val - ? val.match(/[a-zA-Z\u00C0-\u024F\u1E00-\u1EFF0-9_-]+/g) - : [val] - - this.nameError = - match[0] !== val ? 'Only a-zA-Z0-9_- chars are allowed' : null + this.nameError = this.validateTopic(val) }, newLoc (val) { - var match = val - ? val.match(/[a-zA-Z\u00C0-\u024F\u1E00-\u1EFF0-9_-]+/g) - : [val] - - this.locError = - match[0] !== val ? 'Only a-zA-Z0-9_- chars are allowed' : null + this.locError = this.validateTopic(val) }, selectedNode () { if (this.selectedNode) { @@ -903,6 +893,13 @@ export default { showSnackbar (text) { this.$emit('showSnackbar', text) }, + validateTopic (name) { + var match = name + ? name.match(/[/a-zA-Z\u00C0-\u024F\u1E00-\u1EFF0-9_-]+/g) + : [name] + + return match[0] !== name ? 'Only a-zA-Z0-9_- chars are allowed' : null + }, selectNode (item) { if (!item) return