Skip to content
Snippets Groups Projects
Commit 5354eb0d authored by Matthias Stefan Bodenbenner's avatar Matthias Stefan Bodenbenner
Browse files

fixed stripping of ".soil" file ending

parent 4100be72
No related branches found
No related tags found
No related merge requests found
Pipeline #456082 failed
...@@ -158,7 +158,7 @@ async def generate(target: Target, model: str, files: list[UploadFile], backgrou ...@@ -158,7 +158,7 @@ async def generate(target: Target, model: str, files: list[UploadFile], backgrou
file_exists = True file_exists = True
break break
model_without_file_ending = model.rstrip('.soil') model_without_file_ending = model.replace('.soil', '')
# check if the specified target is valid # check if the specified target is valid
if target not in ['python', 'cpp', 'schema', 'metadata', 'profiles', 'json']: if target not in ['python', 'cpp', 'schema', 'metadata', 'profiles', 'json']:
...@@ -231,6 +231,7 @@ async def generate(target: Target, model: str, files: list[UploadFile], backgrou ...@@ -231,6 +231,7 @@ async def generate(target: Target, model: str, files: list[UploadFile], backgrou
clean_up_generation(identifier) clean_up_generation(identifier)
raise HTTPException(status_code=400, detail=response_log) raise HTTPException(status_code=400, detail=response_log)
elif len(os.listdir(out_path)) > 0: elif len(os.listdir(out_path)) > 0:
print(os.path.join(out_path, model_without_file_ending))
shutil.make_archive(os.path.join(out_path, model_without_file_ending), 'zip', shutil.make_archive(os.path.join(out_path, model_without_file_ending), 'zip',
os.path.join(out_path, model_without_file_ending)) os.path.join(out_path, model_without_file_ending))
return fastapi.responses.FileResponse(f'{os.path.join(out_path, model_without_file_ending)}.zip') return fastapi.responses.FileResponse(f'{os.path.join(out_path, model_without_file_ending)}.zip')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment