skip more stuff windows doesn't like

This commit is contained in:
ed 2022-04-28 10:31:10 +02:00
parent 4e8b651e18
commit 9269bc84f2
2 changed files with 11 additions and 5 deletions

View file

@ -210,11 +210,14 @@ class HttpCli(object):
self.uparam = uparam
self.cookies = cookies
self.vpath = unquotep(vpath) # not query, so + means +
ok = "\x00" not in self.vpath
if ANYWIN:
mod = relchk(self.vpath)
if mod:
self.log("invalid relpath [{}]".format(self.vpath))
return self.tx_404() and self.keepalive
ok = ok and not relchk(self.vpath)
if not ok:
self.log("invalid relpath [{}]".format(self.vpath))
return self.tx_404() and self.keepalive
pwd = None
ba = self.headers.get("authorization")

View file

@ -942,9 +942,12 @@ def sanitize_fn(fn, ok, bad):
def relchk(rp):
if ANYWIN:
if "\n" in rp or "\r" in rp:
return "x\nx"
p = re.sub(r'[\\:*?"<>|]', "", rp)
if p != rp:
return p
return "[{}]".format(p)
def absreal(fpath):