better check on valid selectors

master
KatolaZ 7 years ago
parent 1abda73794
commit ac38bc1fac
  1. 10
      gosher

@ -26,8 +26,8 @@ NETCAT=netcat
OPREFIX=/tmp/outf_
IPREFIX=/tmp/inf_
DEBUG=
##DEBUG=yes
##DEBUG=
DEBUG=yes
## function
@ -121,9 +121,11 @@ selector=$(echo $selector | sed -r 's:\r::g' )
}
case $selector in
/*|"")
/?*|"")
RP1=$(realpath "${GOPHERDIR}"/"${selector}" || "")
RP2=$(realpath $(realpath "${GOPHERDIR}")"${selector}")
[ $? -eq 0 ] || invalid_selector "$selector"
RP2=$(realpath "${GOPHERDIR}")"${selector}"
[ $? -eq 0 ] || invalid_selector "$selector"
[ -n "$DEBUG" ] && {
echo "iRP1: ${RP1}"
echo "iRP2: ${RP2}"

Loading…
Cancel
Save