use proper library placeholders for response header

This commit is contained in:
BluBb_mADe 2019-06-04 18:39:19 +02:00
parent 0ae5fd12d7
commit 8475d15268
Signed by: Gardener
GPG Key ID: 1FAEB4540A5B4D1D

View File

@ -8,7 +8,7 @@ from collections import defaultdict
from Cryptodome.Cipher import AES
from Cryptodome.Util import Padding
from aiohttp import web
from aiohttp import web, hdrs
class AttrDict(dict):
@ -126,8 +126,10 @@ async def handle_download(req, acc, acc_db):
fhash = req.match_info.get('hash', '').split('.', 1)[0]
if fhash not in acc_db:
return web.Response(text='file not found', status=404)
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]}"'
})