Fix sx-browser.js cache bust: use correct path for hash computation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m4s

_script_hash used relative Path("static") which resolved to /app/static/
inside the container, but the file is at /app/shared/static/. Use
Path(__file__).parent.parent to resolve from shared/ correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 22:38:49 +00:00
parent 179631130c
commit 81d8e55fb0

View File

@@ -1047,7 +1047,7 @@ def _script_hash(filename: str) -> str:
"""Compute MD5 hash of a static script file, cached for process lifetime."""
if filename not in _SCRIPT_HASH_CACHE:
try:
data = (Path("static") / "scripts" / filename).read_bytes()
data = (Path(__file__).resolve().parent.parent / "static" / "scripts" / filename).read_bytes()
_SCRIPT_HASH_CACHE[filename] = hashlib.md5(data).hexdigest()[:8]
except OSError:
_SCRIPT_HASH_CACHE[filename] = "dev"