From ed834d50d3e0d85cefa87964080f455dc7ebcdc1 Mon Sep 17 00:00:00 2001 From: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Date: Thu, 27 Jan 2022 14:57:40 +0100 Subject: [PATCH] fixed non-number-argument in listmailuser (#2382) --- target/bin/listmailuser | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/bin/listmailuser b/target/bin/listmailuser index 6f52ab9b..635cfdfe 100755 --- a/target/bin/listmailuser +++ b/target/bin/listmailuser @@ -4,15 +4,19 @@ . /usr/local/bin/helper-functions.sh # suppress error output, e.g. when listmailuser runs in a fresh container (DMS not running) -. /etc/dms-settings 2> /dev/null +# shellcheck source=/dev/null +. /etc/dms-settings 2>/dev/null function dovecot_quota_to_hr() { - if [[ ${1} == "-" ]] + if [[ ${1:-} == "-" ]] then echo "~" - else + elif [[ ${1:-} =~ ^[0-9]+$ ]] + then echo $(( 1024 * ${1} )) | numfmt --to=iec + else + notify 'err' "Supplied non-number argument '${1:-}' to 'dovecot_quota_to_hr()' in script 'listmailuser'" fi }