0.34.6_repo_cleanup
This commit is contained in:
1 parent
ce1a90397c
commit
133d2f0f91
273 files changed
+5969
-6926
No files matched your search
@@ -108,8 +108,7 @@ def read_assets(path: Path, checksum: str | None) -> tuple[dict[str, bytes], str
|
||||
snapshot = stream.read(MAX_ARCHIVE + 1)
|
||||
if not 0 < len(snapshot) <= MAX_ARCHIVE:
|
||||
raise AssetError("Swagger archive exceeds the 64 MiB limit.")
|
||||
# Parse exactly the same bounded bytes that were hashed, not a reopened file
|
||||
# that could have changed between verification and ZIP member reads.
|
||||
|
||||
digest = hashlib.sha256(snapshot).hexdigest()
|
||||
if checksum and digest != checksum:
|
||||
raise AssetError("Swagger archive SHA-256 mismatch; no assets were published.")
|
||||
@@ -217,12 +216,10 @@ def main() -> int:
|
||||
checksum = expected_digest(os.environ.get("SWAGGER_UI_ARCHIVE_SHA256"))
|
||||
offline = os.environ.get("CARGO_NET_OFFLINE", "").lower() in ("1", "true")
|
||||
paths = prepare(args.out_dir.resolve(), source, checksum, offline=offline)
|
||||
# A fresh cryptographically random build identifier, shared by all JS/CSS assets.
|
||||
# Regenerated only when Cargo actually runs the build script.
|
||||
|
||||
import secrets
|
||||
atomic_write(args.out_dir.resolve() / "asset-build-id.txt", secrets.token_hex(8).encode("ascii"))
|
||||
for path in paths:
|
||||
# These values are Cargo directives, so never allow extra output lines.
|
||||
if any(c in str(path) for c in "\r\n\0"):
|
||||
raise AssetError("Build input/output path contains an invalid control character.")
|
||||
print(f"cargo:rerun-if-changed={path}")
|
||||
|
||||
Reference in new issue
Block a user