mirror of
https://github.com/open-webui/open-webui
synced 2025-02-23 13:51:07 +00:00
Return 404 for non html files
This commit is contained in:
parent
16bae8f33a
commit
5d68737b31
@ -330,7 +330,13 @@ class SPAStaticFiles(StaticFiles):
|
|||||||
return await super().get_response(path, scope)
|
return await super().get_response(path, scope)
|
||||||
except (HTTPException, StarletteHTTPException) as ex:
|
except (HTTPException, StarletteHTTPException) as ex:
|
||||||
if ex.status_code == 404:
|
if ex.status_code == 404:
|
||||||
return await super().get_response("index.html", scope)
|
if path.endswith(".html"):
|
||||||
|
response = await super().get_response("index.html", scope)
|
||||||
|
response.status_code = 200
|
||||||
|
return response
|
||||||
|
else:
|
||||||
|
# Return 404 for non-HTML files
|
||||||
|
raise ex
|
||||||
else:
|
else:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user