error handling

This commit is contained in:
ed 2019-07-11 16:54:13 +00:00
parent 051c782c28
commit 456fab2e0b
3 changed files with 13 additions and 7 deletions

View file

@ -642,7 +642,11 @@ class HttpCli(object):
href = "/" + vpath + "/" + fn href = "/" + vpath + "/" + fn
fspath = fsroot + "/" + fn fspath = fsroot + "/" + fn
try:
inf = os.stat(fsenc(fspath)) inf = os.stat(fsenc(fspath))
except FileNotFoundError as ex:
self.log("broken symlink: {}".format(fspath))
continue
is_dir = stat.S_ISDIR(inf.st_mode) is_dir = stat.S_ISDIR(inf.st_mode)
if is_dir: if is_dir:

View file

@ -183,7 +183,7 @@ class MultipartParser(object):
buf = self.sr.recv(bufsz) buf = self.sr.recv(bufsz)
if not buf: if not buf:
# abort: client disconnected # abort: client disconnected
raise Pebkac(400, "client disconnected during post") raise Pebkac(400, "client disconnected during multipart post")
while True: while True:
ofs = buf.find(self.boundary) ofs = buf.find(self.boundary)
@ -217,7 +217,7 @@ class MultipartParser(object):
buf2 = self.sr.recv(bufsz) buf2 = self.sr.recv(bufsz)
if not buf2: if not buf2:
# abort: client disconnected # abort: client disconnected
raise Pebkac(400, "client disconnected during post") raise Pebkac(400, "client disconnected during multipart post")
buf += buf2 buf += buf2
@ -397,6 +397,9 @@ def read_socket(sr, total_size):
bufsz = remains bufsz = remains
buf = sr.recv(bufsz) buf = sr.recv(bufsz)
if not buf:
raise Pebkac(400, "client disconnected during binary post")
remains -= len(buf) remains -= len(buf)
yield buf yield buf

View file

@ -1,3 +1,6 @@
* {
line-height: 1.2em;
}
html,body,tr,th,td,#files,a { html,body,tr,th,td,#files,a {
color: inherit; color: inherit;
background: none; background: none;
@ -11,7 +14,6 @@ html {
background: #333; background: #333;
font-family: sans-serif; font-family: sans-serif;
text-shadow: 1px 1px 0px #000; text-shadow: 1px 1px 0px #000;
line-height: 1.3em;
} }
html, body { html, body {
margin: 0; margin: 0;
@ -23,7 +25,6 @@ body {
#path, #path,
#path * { #path * {
font-size: 1em; font-size: 1em;
line-height: 1em;
} }
#path { #path {
color: #aca; color: #aca;
@ -168,7 +169,6 @@ a.play.act {
text-align: center; text-align: center;
background: #444; background: #444;
border-radius: 2em; border-radius: 2em;
line-height: 1em;
} }
#widget { #widget {
position: fixed; position: fixed;
@ -246,7 +246,6 @@ a.play.act {
font-size: 1.25em; font-size: 1.25em;
width: 1.3em; width: 1.3em;
height: 1.2em; height: 1.2em;
line-height: 1em;
text-align: center; text-align: center;
margin-right: .5em; margin-right: .5em;
border-radius: .3em; border-radius: .3em;