Skip to content

Commit

Permalink
Fix ability to add groups with spaces in them if thy are enclosed in …
Browse files Browse the repository at this point in the history
…quotes

Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Dec 23, 2024
1 parent fcbc8a7 commit cfa26d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/js/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.replace(/(^"|"$)/g, '');
});
// Remove empty elements
names = names.filter(function (el) {
return el !== "";
Expand Down

0 comments on commit cfa26d5

Please sign in to comment.