Merge branch 'pr-14452' into fix/main-green

This commit is contained in:
David Mann committed 2026-11-14 15:22:29 +01:00
commit 6372c11319
3 files changed
+6 -1

No files matched your search

+2
View File
@@ -155,6 +155,8 @@ impl ByteSource for ZipSource<'_> {
fn bundle_error(error: craft_pcraft_bundle::Error) -> FormatError {
match error {
craft_pcraft_bundle::Error::LimitExceeded { entry, limit } => FormatError::LimitExceeded(format!("`{entry}` exceeds {limit} bytes")),
// A ZIP member past its read bound arrives as a craft-zip error, not as `LimitExceeded`.
craft_pcraft_bundle::Error::Zip(error) => crate::zip::map_read_error(error),
other => FormatError::corrupt(other.to_string()),
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ pub struct ZipReader<'a> {
by_name: HashMap<String, usize>,
}
fn map_read_error(error: craft_zip::Error) -> FormatError {
pub(crate) fn map_read_error(error: craft_zip::Error) -> FormatError {
match error {
craft_zip::Error::TooManyEntries { .. }
| craft_zip::Error::TooManyEndRecords(_)
@@ -19,6 +19,9 @@ fn directory_cleanup_preserves_unrelated_zst_files() {
let mut writer = PcraftWriter::new();
writer.save_dir(&empty_doc(), &bundle, &SaveOptions::default()).unwrap();
// An empty document writes no objects, so a save creates neither folder.
std::fs::create_dir_all(bundle.join("tiles")).unwrap();
std::fs::create_dir_all(bundle.join("blobs")).unwrap();
let unrelated = bundle.join("tiles/personal-notes.zst");
let orphan = bundle.join("blobs").join(format!("{}.zst", "b".repeat(64)));
std::fs::write(&unrelated, b"unrelated file").unwrap();