From be52f8e2231bd5d586c00d0fbb9c431fe92121f9 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Mon, 23 Mar 2026 20:46:34 +0100 Subject: [PATCH] style: formatting cleanup in api.func and core.func --- misc/api.func | 14 +++++++------- misc/core.func | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/misc/api.func b/misc/api.func index a268c919c..3e1ed1497 100644 --- a/misc/api.func +++ b/misc/api.func @@ -348,10 +348,10 @@ explain_exit_code() { json_escape() { # Escape a string for safe JSON embedding using awk (handles any input size). # Pipeline: strip ANSI → remove control chars → escape \ " TAB → join lines with \n - printf '%s' "$1" \ - | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' \ - | tr -d '\000-\010\013\014\016-\037\177\r' \ - | awk ' + printf '%s' "$1" | + sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | + tr -d '\000-\010\013\014\016-\037\177\r' | + awk ' BEGIN { ORS = "" } { gsub(/\\/, "\\\\") # backslash → \\ @@ -1333,10 +1333,10 @@ post_addon_to_api() { while IFS='=' read -r _k _v; do _v="${_v//\"/}" case "$_k" in - ID) os_type="$_v" ;; - VERSION_ID) os_version="$_v" ;; + ID) os_type="$_v" ;; + VERSION_ID) os_version="$_v" ;; esac - done < /etc/os-release + done /dev/null)" for ip in "${_ips6[@]}"; do - [[ "$ip" == *:* ]] && { echo "$ip"; return 0; } + [[ "$ip" == *:* ]] && { + echo "$ip" + return 0 + } done fi