fix: skip preloading bundled assets if http_status_code is 404

Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
This commit is contained in:
Rucha Mahabal 2025-03-15 15:27:03 +05:30
parent 217debdcfc
commit 85bcc372e7

View file

@ -557,7 +557,8 @@ def build_response(path, data, http_status_code, headers: dict | None = None):
response.headers["X-Page-Name"] = cstr(cstr(path).encode("ascii", errors="xmlcharrefreplace"))
response.headers["X-From-Cache"] = frappe.local.response.from_cache or False
add_preload_for_bundled_assets(response)
if http_status_code != 404:
add_preload_for_bundled_assets(response)
if headers:
for key, val in headers.items():