Make image upload resilient to crashes

This commit is contained in:
Zed 2019-06-25 15:09:43 +02:00
parent 2f51de90d0
commit 12cf772616

View file

@ -70,7 +70,12 @@ routes:
await client.downloadFile($uri, filename)
client.close()
sendFile(filename)
if not existsFile(filename):
resp Http404
let file = openAsync(filename)
defer: file.close()
resp await readAll(file), mimetype(filename)
get "/video/@sig/@url":
cond "http" in @"url"