2
0
Fork 0

sh.zio.backup: handle empty message in notification

main
Ducky 2024-04-02 00:12:52 +01:00
parent 41c730e999
commit a06ebcb217
1 changed files with 12 additions and 8 deletions

View File

@ -157,18 +157,22 @@ function trigger_notify() {
notify_prog="/usr/local/bin/sh.zio.notify" notify_prog="/usr/local/bin/sh.zio.notify"
if [[ $log_path == "" ]]; then if [[ $log_path == "" ]]; then
log_path="$message" if [[ -f "$message" ]]; then
message="" log_path="$message"
message=""
fi
fi fi
if [[ ! -f "$notify_prog" ]]; then if [[ ! -f "$notify_prog" ]]; then
say warning "'$notify_prog' not found. Not sending notification" say warning "'$notify_prog' does not exist. Not sending notification"
else else
"$notify_prog" \ notify_command="$notify_prog"
--file "$log_path" \ [[ -n "$log_path" ]] && notify_command+=" --file \"$log_path\""
--level "$level" \ [[ -n "$message" ]] && notify_command+=" --message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`'"
--message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`' \ notify_command+=" --level $level"
--title "$title" notify_command+=" --title \"$title\""
eval $notify_command
fi fi
} }