Don't use Path object to return fileresponses

This commit is contained in:
Matthias 2021-01-31 14:54:58 +01:00
parent 7b3d99819f
commit a87a885ccd

View File

@ -22,10 +22,10 @@ async def index_html(rest_of_path: str):
raise HTTPException(status_code=404, detail="Not Found")
uibase = Path(__file__).parent / 'ui'
if (uibase / rest_of_path).is_file():
return FileResponse(uibase / rest_of_path)
return FileResponse(str(uibase / rest_of_path))
index_file = uibase / 'index.html'
if not index_file.is_file():
return FileResponse(uibase / 'fallback_file.html')
return FileResponse(str(uibase / 'fallback_file.html'))
# Fall back to index.html, as indicated by vue router docs
return FileResponse(index_file)
return FileResponse(str(index_file))