1
0
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:
Tw93
2025-12-11 12:55:27 +08:00
parent aac0841759
commit 7e3f09ae7f

View File

@@ -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