fixed double extension
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Hipstercat <tasty@hipstercat.fr>
This commit is contained in:
Amazed 2021-12-23 01:17:08 +01:00
parent 17a291daa3
commit 4c90805a38
Signed by: hipstercat
GPG Key ID: BF42C937290F5641

View File

@ -62,10 +62,11 @@ async def upload_map(map_in: MapIn):
if existing_map:
return MapOut(**existing_map[0])
else:
uploaded_filename = f"{filename}.gck"
uploaded_filename = filename
i = 0
while os.path.exists(f"{config['upload_path']}{uploaded_filename}"):
uploaded_filename = f"{filename}-{i}.gck"
file_wo_ext = ".".join(filename.split('.')[0:-1])
uploaded_filename = f"{file_wo_ext}-{i}.gck"
i += 1
with open(f"{config['upload_path']}{uploaded_filename}", "wb") as fp:
fp.write(map_bytes)