The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
dont cache new locale entry points (#10101)
Christian Byrneed0f4a609b5e
diff --git a/middleware/cache_middleware.py b/middleware/cache_middleware.pyindex 374ef7934..f02135369 100644--- a/middleware/cache_middleware.py+++ b/middleware/cache_middleware.py@@ -26,11 +26,12 @@ async def cache_control("""Cache control middleware that sets appropriate cache headers based on file type and response status"""response: web.Response = await handler(request)- if (- request.path.endswith(".js")- or request.path.endswith(".css")- or request.path.endswith("index.json")- ):+ path_filename = request.path.rsplit("/", 1)[-1]+ is_entry_point = path_filename.startswith("index") and path_filename.endswith(+ ".json"+ )++ if request.path.endswith(".js") or request.path.endswith(".css") or is_entry_point:response.headers.setdefault("Cache-Control", "no-cache")return responsediff --git a/tests-unit/server_test/test_cache_control.py b/tests-unit/server_test/test_cache_control.pyindex 8de59125a..fa68d9408 100644--- a/tests-unit/server_test/test_cache_control.py+++ b/tests-unit/server_test/test_cache_control.py@@ -48,6 +48,13 @@ CACHE_SCENARIOS = ["expected_cache": "no-cache","should_have_header": True,},+ {+ "name": "localized_index_json_no_cache",+ "path": "/templates/index.zh.json",+ "status": 200,+ "expected_cache": "no-cache",+ "should_have_header": True,+ },# Non-matching files{"name": "html_no_header",