1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Format Milestone 4 hardening code

This commit is contained in:
Andraxion 2026-07-29 15:05:11 -04:00
parent cca374bf99
commit 663811b1d3
2 changed files with 7 additions and 12 deletions

View file

@ -178,9 +178,7 @@ def write_extraction_cache(
for source in cache.sources
],
}
encoded = (
json.dumps(document, sort_keys=True, separators=(",", ":")).encode("utf-8") + b"\n"
)
encoded = json.dumps(document, sort_keys=True, separators=(",", ":")).encode("utf-8") + b"\n"
if len(encoded) > max_bytes:
raise DocForgeError(
"cache_limit",

View file

@ -371,15 +371,12 @@ def _atomic_replace(
f"in {temporary_name}"
) from error
temporary_contains_only_staged_content = True
if (
not _same_identity_after_rename(
if not _same_identity_after_rename(
_file_identity(directory_fd, name),
displaced,
)
or not _same_identity_after_rename(
) or not _same_identity_after_rename(
_file_identity(directory_fd, temporary_name),
staged,
)
):
raise CommandReferenceToolError(
"Output target raced publication and could not be safely restored"