fixed server start crash if a file didn't contain a "_"

This commit is contained in:
BluBb_mADe 2019-06-04 18:37:25 +02:00
parent d9167638f6
commit 0bf1d470da
Signed by: Gardener
GPG Key ID: 1FAEB4540A5B4D1D

View File

@ -138,8 +138,9 @@ def main():
if not os.path.isdir(f'{conf.data_path}/{acc}'): if not os.path.isdir(f'{conf.data_path}/{acc}'):
continue continue
for file in os.listdir(f"{conf.data_path}/{acc}"): for file in os.listdir(f"{conf.data_path}/{acc}"):
fhash, fname = file.split('_', 1) if "_" in file:
file_db[acc][fhash] = fname fhash, fname = file.split('_', 1)
file_db[acc][fhash] = fname
app = web.Application(middlewares=[prepare]) app = web.Application(middlewares=[prepare])
app.router.add_post(conf.prefix + '/post/{acc}', handle_upload) app.router.add_post(conf.prefix + '/post/{acc}', handle_upload)