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 for source in cache.sources
], ],
} }
encoded = ( encoded = json.dumps(document, sort_keys=True, separators=(",", ":")).encode("utf-8") + b"\n"
json.dumps(document, sort_keys=True, separators=(",", ":")).encode("utf-8") + b"\n"
)
if len(encoded) > max_bytes: if len(encoded) > max_bytes:
raise DocForgeError( raise DocForgeError(
"cache_limit", "cache_limit",

View file

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