mirror of
https://github.com/tw93/Mole.git
synced 2026-02-05 16:43:53 +00:00
fix: remove trailing space in json_escape to prevent unknown action errors
This commit is contained in:
@@ -87,7 +87,9 @@ get_uptime_days() {
|
||||
# JSON escape helper
|
||||
json_escape() {
|
||||
# Escape backslash, double quote, tab, and newline
|
||||
echo -n "$1" | sed 's/\\/\\\\/g; s/"/\\"/g; s/ /\\t/g' | tr '\n' ' '
|
||||
local escaped
|
||||
escaped=$(echo -n "$1" | sed 's/\\/\\\\/g; s/"/\\"/g; s/ /\\t/g' | tr '\n' ' ')
|
||||
echo -n "${escaped% }"
|
||||
}
|
||||
|
||||
# Generate JSON output
|
||||
|
||||
Reference in New Issue
Block a user