mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 12:21:11 +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 helper
|
||||||
json_escape() {
|
json_escape() {
|
||||||
# Escape backslash, double quote, tab, and newline
|
# 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
|
# Generate JSON output
|
||||||
|
|||||||
Reference in New Issue
Block a user