Fix exception when image path is empty

This commit is contained in:
Zed 2019-10-24 00:04:54 +02:00
parent 510abb9b50
commit a56f217074
1 changed files with 3 additions and 0 deletions

View File

@ -21,6 +21,9 @@ proc createMediaRouter*(cfg: Config) =
let path = uri.path.split("/")[2 .. ^1].join("/")
let filename = cfg.cacheDir / cleanFilename(path & uri.query)
if path.len == 0:
resp Http404
if not existsDir(cfg.cacheDir):
createDir(cfg.cacheDir)