From 5a4834fc9a05b590274153ee477bae25f53c460b Mon Sep 17 00:00:00 2001 From: SamNet-dev Date: Sat, 7 Feb 2026 10:44:17 -0600 Subject: [PATCH] fix: remove invalid brace escapes in YAML escape regex Escaped braces \{\} inside a character class [...] cause "Invalid content of \{\}" errors on some bash versions. Curly braces are literal inside character classes and don't need escaping. --- paqctl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paqctl.sh b/paqctl.sh index 37a34a2..3fa3e31 100644 --- a/paqctl.sh +++ b/paqctl.sh @@ -875,7 +875,7 @@ generate_config() { _escape_yaml() { local s="$1" # If value contains special chars, quote it - if [[ "$s" =~ [:\#\[\]\{\}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then + if [[ "$s" =~ [:\#\[\]{}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then s="${s//\\/\\\\}" # Escape backslashes s="${s//\"/\\\"}" # Escape double quotes printf '"%s"' "$s" @@ -4573,7 +4573,7 @@ change_config() { # Escape YAML special characters to prevent injection _escape_yaml() { local s="$1" - if [[ "$s" =~ [:\#\[\]\{\}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then + if [[ "$s" =~ [:\#\[\]{}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then s="${s//\\/\\\\}"; s="${s//\"/\\\"}"; printf '"%s"' "$s" else printf '%s' "$s" @@ -5713,7 +5713,7 @@ _install_paqet_components() { # Helper to escape YAML values _escape_yaml_val() { local s="$1" - if [[ "$s" =~ [:\#\[\]\{\}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then + if [[ "$s" =~ [:\#\[\]{}\"\'\|\>\<\&\*\!\%\@\`] ]] || [[ "$s" =~ ^[[:space:]] ]] || [[ "$s" =~ [[:space:]]$ ]]; then s="${s//\\/\\\\}"; s="${s//\"/\\\"}"; printf '"%s"' "$s" else printf '%s' "$s"