]> git.99rst.org Git - openwrt-packages.git/commitdiff
nut: fix custom notification messages
authorDaniel F. Dickinson <redacted>
Thu, 27 Aug 2026 10:15:02 +0000 (06:15 -0400)
committerJosef Schlehofer <redacted>
Thu, 10 Sep 2026 08:22:36 +0000 (10:22 +0200)
Messages with spaces must be enclosed in double-quotes.

Signed-off-by: Daniel F. Dickinson <redacted>
net/nut/files/nut-monitor-config.sh.functions

index 1b80e36f414716d784eb0af2a1e84fd41da1f6f0..c9342718478ec522c9215d44c900be68f877b7c3 100644 (file)
@@ -61,7 +61,8 @@ nut_get_notifications() {
        if [ "${event_types#*" $event "}" != "${event_types}" ]; then
                config_get val "$event" message
                if [ -n "$val" ]; then
-                       if ! printf 'NOTIFYMSG %s %s\n' "$event" "$val" >>"$config_file"; then
+                       val="$(printf '%s' "$val" | tr -d '"')"
+                       if ! printf 'NOTIFYMSG %s "%s"\n' "$event" "$val" >>"$config_file"; then
                                log_error "upsmon section '$event' failed to write 'NOTIFYMSG' for '$event'" nut-monitor-config.sh nut-monitor-config
                                return 1
                        fi
git clone https://git.99rst.org/PROJECT