fixed missing quotes

fixed error with default config path
This commit is contained in:
BluBb_mADe 2018-08-01 17:35:38 +02:00
parent dee5744f89
commit d9167638f6
Signed by untrusted user: Gardener
GPG Key ID: 1FAEB4540A5B4D1D

View File

@ -127,7 +127,7 @@ async def handle_download(req, acc, acc_db):
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]}' 'CONTENT-DISPOSITION': f'inline;filename="{acc_db[fhash]}"'
}) })
@ -152,7 +152,7 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
valid_hash_chars = set(string.hexdigits) valid_hash_chars = set(string.hexdigits)
file_db = defaultdict(dict) file_db = defaultdict(dict)
confname = os.path.isfile(sys.argv[1:]) and sys.argv[1] or 'config.yaml' confname = sys.argv[1] if sys.argv[1:] and os.path.isfile(sys.argv[1]) else 'config.yaml'
with open(confname) as cf: with open(confname) as cf:
conf = cast_to_ad(yaml.load(cf)) conf = cast_to_ad(yaml.load(cf))
if conf.url_hash_len > 31: if conf.url_hash_len > 31: