Merge pull request #9800 from rragundez/404-non-html
WIP Return 404 for non html files
This commit is contained in:
1 file changed
+4
@@ -330,6 +330,10 @@ 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:
|
||||||
|
if path.endswith(".js"):
|
||||||
|
# Return 404 for javascript files
|
||||||
|
raise ex
|
||||||
|
else:
|
||||||
return await super().get_response("index.html", scope)
|
return await super().get_response("index.html", scope)
|
||||||
else:
|
else:
|
||||||
raise ex
|
raise ex
|
||||||
|
|||||||
Reference in new issue
Block a user