소스 검색

Merge pull request #9800 from rragundez/404-non-html

WIP Return 404 for non html files
Timothy Jaeryang Baek 3 달 전
부모
커밋
a1554559c4
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      backend/open_webui/main.py

+ 5 - 1
backend/open_webui/main.py

@@ -330,7 +330,11 @@ class SPAStaticFiles(StaticFiles):
             return await super().get_response(path, scope)
         except (HTTPException, StarletteHTTPException) as ex:
             if ex.status_code == 404:
-                return await super().get_response("index.html", scope)
+                if path.endswith(".js"):
+                    # Return 404 for javascript files
+                    raise ex
+                else:
+                    return await super().get_response("index.html", scope)
             else:
                 raise ex