diff --git a/droopy b/droopy index 431fd6f..b350e56 100755 --- a/droopy +++ b/droopy @@ -713,12 +713,14 @@ class HTTPUploadHandler(BaseHTTPServer.BaseHTTPRequestHandler): # -- Save file (numbered to avoid overwriting, ex: foo-3.png) form = DroopyFieldStorage(fp = self.rfile, environ = env); fileitem = form[self.form_field] + realname="" if self.form_realname in form.keys(): realname = form[self.form_realname].value.decode('utf-8') + if realname=="": + filename = self.basename(fileitem.filename).decode('utf-8') + else: self.log_message("Got realname: %s", realname) filename=self.basename(realname) - else: - filename = self.basename(fileitem.filename).decode('utf-8') if filename == "": self.send_response(303) diff --git a/qcd_function b/qcd_function index 09e476c..c707354 100644 --- a/qcd_function +++ b/qcd_function @@ -19,8 +19,9 @@ function qcd() { local OPTIND local OPTARG local opt + local case - while getopts aLl:hm opt + while getopts aiLl:hm opt do case "$opt" in a) # Adding @@ -33,6 +34,9 @@ function qcd() { echo "$name":$( pwd ) >> ~/.qcd return ;; + i) + case="-i" + ;; L) echo ==History ~/.bash_cdhistory: cat ~/.bash_cdhistory @@ -42,7 +46,7 @@ function qcd() { return ;; l) - local d=$( grep -h ^"$OPTARG" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 ) + local d=$( grep $case -h ^"$OPTARG" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 ) d=${d/*:/} echo $d return @@ -64,14 +68,14 @@ function qcd() { return ;; h) - echo 'qcd [-mLh]|[-al] [name] + echo 'qcd [-hiLm]|[-al] [name] Change current working path based on the list ~/.qcd Keeps a history of folders visited in ~/.bash_cdhistory -a [name] Adds the path to the list You may add the name of the path, but when omitted the basename will be used - + -i Case insensitive search, must come first. -l [name] Show the match, but do not change -L Lists the paths -m Maintain the list, deleting non-existing entries' @@ -79,17 +83,21 @@ Keeps a history of folders visited in ~/.bash_cdhistory ;; esac done + shift $(($OPTIND - 1)) unset OPTSTRING unset OPTIND if [ -z "$1" ] - then \cd - else - d=$( grep -h ^"$1" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 ) - d=${d/*:/} - if [ ! -z "$d" ] - then \cd "$d" - fi + then \cd; return fi + if [ "$1" = "-" ] + then \cd -; return + fi + d=$( grep $case -h ^"$1" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 ) + d=${d/*:/} + if [ ! -z "$d" ] + then \cd "$d" + fi + }