fix getKeyDB

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-19 22:43:52 +02:00
parent 21f29a496f
commit fa6ad3e6a8
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.98-dev-48-g9adc62d
#### $$VERSION$$ v0.98-dev-59-g21f29a4
#
# source from commands.sh to use jsonDB functions
#
@ -106,8 +106,8 @@ if [ "$(LC_ALL=C type -t "flock")" = "file" ]; then
alias jssh_getDB=jssh_getKeyDB
jssh_getKeyDB() {
[[ "$1" =~ ^[-a-zA-Z0-9,._]+$ ]] || return 3
[ -z "${DB}" ] && return 1
local DB; DB="$(jssh_checkDB "$2")"
[ -z "${DB}" ] && return 1
# start atomic delete here, exclusive max wait 1s
{ flock -s -w 1 200
[ -r "${DB}" ] && sed -n 's/\["'"$1"'"\]\t*"\(.*\)"/\1/p' <"${DB}" | tail -n 1

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.98-dev-58-ge4d13fd
#### $$VERSION$$ v0.98-dev-59-g21f29a4
# will be automatically sourced from bashbot
@ -30,7 +30,7 @@ send_normal_message() {
local len text; text="$(JsonEscape "${2}")"
text="${text//$'\n'/\\n}"
until [ -z "${text}" ]; do
if [ "${#text}" -le 4096 ]; then\
if [ "${#text}" -le 4096 ]; then
sendJson "${1}" '"text":"'"${text}"'"' "${MSG_URL}"
unset text
else