Make image upload resilient to crashes
This commit is contained in:
parent
2f51de90d0
commit
12cf772616
1 changed files with 6 additions and 1 deletions
|
@ -70,7 +70,12 @@ routes:
|
||||||
await client.downloadFile($uri, filename)
|
await client.downloadFile($uri, filename)
|
||||||
client.close()
|
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":
|
get "/video/@sig/@url":
|
||||||
cond "http" in @"url"
|
cond "http" in @"url"
|
||||||
|
|
Loading…
Reference in a new issue