Fix image cache skipping files with queries
This commit is contained in:
parent
baa936894d
commit
2e303719f2
1 changed files with 5 additions and 5 deletions
|
@ -51,11 +51,11 @@ routes:
|
||||||
cond "twimg" in @"url"
|
cond "twimg" in @"url"
|
||||||
|
|
||||||
let
|
let
|
||||||
url = decodeUrl(@"url")
|
uri = parseUri(decodeUrl(@"url"))
|
||||||
path = parseUri(url).path.split("/")[2 .. ^1].join("/")
|
path = uri.path.split("/")[2 .. ^1].join("/")
|
||||||
filename = cacheDir / cleanFilename(path)
|
filename = cacheDir / cleanFilename(path & uri.query)
|
||||||
|
|
||||||
if getHmac(url) != @"sig":
|
if getHmac($uri) != @"sig":
|
||||||
resp showError("Failed to verify signature")
|
resp showError("Failed to verify signature")
|
||||||
|
|
||||||
if not existsDir(cacheDir):
|
if not existsDir(cacheDir):
|
||||||
|
@ -63,7 +63,7 @@ routes:
|
||||||
|
|
||||||
if not existsFile(filename):
|
if not existsFile(filename):
|
||||||
let client = newAsyncHttpClient()
|
let client = newAsyncHttpClient()
|
||||||
await client.downloadFile(url, filename)
|
await client.downloadFile($uri, filename)
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
sendFile(filename)
|
sendFile(filename)
|
||||||
|
|
Loading…
Reference in a new issue