use proper library placeholders for response header
This commit is contained in:
parent
0ae5fd12d7
commit
8475d15268
@ -8,7 +8,7 @@ from collections import defaultdict
|
|||||||
|
|
||||||
from Cryptodome.Cipher import AES
|
from Cryptodome.Cipher import AES
|
||||||
from Cryptodome.Util import Padding
|
from Cryptodome.Util import Padding
|
||||||
from aiohttp import web
|
from aiohttp import web, hdrs
|
||||||
|
|
||||||
|
|
||||||
class AttrDict(dict):
|
class AttrDict(dict):
|
||||||
@ -126,8 +126,10 @@ async def handle_download(req, acc, acc_db):
|
|||||||
fhash = req.match_info.get('hash', '').split('.', 1)[0]
|
fhash = req.match_info.get('hash', '').split('.', 1)[0]
|
||||||
if fhash not in acc_db:
|
if fhash not in acc_db:
|
||||||
return web.Response(text='file not found', status=404)
|
return web.Response(text='file not found', status=404)
|
||||||
|
|
||||||
return web.FileResponse(f"{conf.data_path}/{acc}/{fhash}_{acc_db[fhash]}", headers={
|
return web.FileResponse(f"{conf.data_path}/{acc}/{fhash}_{acc_db[fhash]}", headers={
|
||||||
'CONTENT-DISPOSITION': f'inline;filename="{acc_db[fhash]}"'
|
hdrs.CACHE_CONTROL: "no-cache",
|
||||||
|
hdrs.CONTENT_DISPOSITION: f'inline;filename="{acc_db[fhash]}"'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user