diff --git a/doc/6_reference.md b/doc/6_reference.md index f1d3e99..c6dcfc2 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -464,9 +464,9 @@ Usually message is automatically forwarded in 'commands.sh', but you can forwar ### jsshDB Since output generated by JSON.sh is so handy to use in bash, we use the format for a simple keys/value storage and providing fucntions to read and write JSON.sh style data from and to files. -The file extions is '.jssh' and for security reasons location of jssh files is restricted to BASHBOT_ETC. +The file extions is '.jssh' and for security reasons location of jssh files is restricted to BASHBOT_ETC and BASHBOT_DATA.. -Note: File names containg '..' and absolute file names pointing outside BASHBOT_ETC are refused by jsshDB functions. +Note: File names containg '..' and absolute file names pointing outside BASHBOT_ETC or BASHBOT_DATA are refused by jsshDB functions. *Example:* for file name: @@ -935,5 +935,5 @@ The name of your bot is availible as bash variable "$ME", there is no need to ca #### [Prev Best Practice](5_practice.md) #### [Next Notes for Developers](7_develop.md) -#### $$VERSION$$ v0.94-pre-0-gac2ec02 +#### $$VERSION$$ v0.94-pre-6-g1e0de91 diff --git a/modules/jsonDB.sh b/modules/jsonDB.sh index 5d18e14..8bbba30 100644 --- a/modules/jsonDB.sh +++ b/modules/jsonDB.sh @@ -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.94-pre-2-gc0a633f +#### $$VERSION$$ v0.94-pre-6-g1e0de91 # # source from commands.sh to use jsonDB functions # @@ -100,7 +100,9 @@ jssh_newDB() { jssh_checkDB(){ [ -z "$1" ] && return 1 local DB="${BASHBOT_ETC:-.}/$1.jssh" - [[ "$1" = "${BASHBOT_ETC:-.}"* ]] && DB="$1.jssh" + if [[ "$1" = "${BASHBOT_ETC:-.}"* ]] || [[ "$1" = "${BASHBOT_DATA:-.}"* ]]; then + DB="$1.jssh" + fi [[ "$1" = *'..'* ]] && return 2 printf '%s\n' "${DB}" }