Spaces:
Running on Zero
Running on Zero
Download app/assets.py from RealFalconsAI/DecisionLab: direct link, hf CLI and curl.
- Browser
- Download file 591 Bytes
-
https://huggingface.co/spaces/RealFalconsAI/DecisionLab/resolve/main/app/assets.py
- Command line
-
hf download hf://spaces/RealFalconsAI/DecisionLab/app/assets.py
-
curl -L -o assets.py https://huggingface.co/spaces/RealFalconsAI/DecisionLab/resolve/main/app/assets.py
591 Bytes
| """Release-stamped asset URLs for the page. | |
| Every /static/... URL in index.html gets ?v=<release>, so each release has its own addresses and a browser can | |
| never run a stale app.js or app.css cached from an older release (1.8.x files were served without cache headers). | |
| Pure Python: tested anywhere. | |
| """ | |
| from __future__ import annotations | |
| import re | |
| _ASSET = re.compile(r'(["\'])(/static/[^"\'?#]+)\1') | |
| def stamp_assets(html: str, version: str) -> str: | |
| v = re.sub(r"[^A-Za-z0-9._-]+", "-", version) | |
| return _ASSET.sub(lambda m: f"{m.group(1)}{m.group(2)}?v={v}{m.group(1)}", html) | |