]> git.plutz.net Git - clickslide/commitdiff
allow empty fields in POST data
authorpaul <paul@plutz.net>
Sat, 27 Feb 2016 16:13:13 +0000 (16:13 +0000)
committerpaul <paul@plutz.net>
Sat, 27 Feb 2016 16:13:13 +0000 (16:13 +0000)
svn path=/trunk/; revision=21

cgi.sh
misc.sh

diff --git a/cgi.sh b/cgi.sh
index 124496e0895ed11bce06279906cad9ed2c51c2b7..2a6c93091d82bac3044364b3db96fc5b27b4d32b 100755 (executable)
--- a/cgi.sh
+++ b/cgi.sh
@@ -41,9 +41,9 @@ if [ "$REQUEST_METHOD" = POST ]; then
     val="$(printf %s "$query" |sed -r 's:^([a-zA-Z0-9_-]+)=(.*)$:\2:')"
     value="$(printf "$(printf %s "$val" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g;')")"
     n=''
-    if [ -n "${_POST[$key$n]}" ]; then
+    if [ -n "${_POST[$key$n]+x}" ]; then
       n=0
-      while [ -n "${_POST[$key$n]}" ]; do n=$(($n + 1)); done
+      while [ -n "${_POST[$key$n]+x}" ]; do n=$(($n + 1)); done
     fi
     _POST[$key$n]="$value"
     debug "_POST[$key$n] => $value"
diff --git a/misc.sh b/misc.sh
index ee4eaaf511d12b773baa1707a26cae952d76bd05..adc879b3091474e24cbb765a001d211717c1b6d8 100755 (executable)
--- a/misc.sh
+++ b/misc.sh
@@ -53,5 +53,5 @@ invalidate(){
 
 declare -A item_name
 l10n(){
-  [ -n "$item_name[$1]" ] && printf %s "$item_name[$1]" || printf %s "$1"
+  [ -n "$item_name[$1]+x" ] && printf %s "$item_name[$1]" || printf %s "$1"
 }