Fix ability to add groups with spaces in them if thy are enclosed in quotes

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-12-23 17:47:48 +01:00
parent fcbc8a709f
commit f91e8a0f49

View File

@@ -235,11 +235,15 @@ function addGroup() {
const comment = $("#new_comment").val();
// Check if the user wants to add multiple groups (space or newline separated)
// If so, split the input and store it in an array
// If so, split the input and store it in an array, however, do not split
// group names enclosed in quotes
var names = utils
.escapeHtml($("#new_name"))
.val()
.split(/[\s,]+/);
.match(/(?:[^\s"]+|"[^"]*")+/g)
.map(function (name) {
return name.replaceAll(/(^"|"$)/g, "");
});
// Remove empty elements
names = names.filter(function (el) {
return el !== "";