#2837: the fixture's archive reader takes its limit from MAX_ARCHIVE_BYTES

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Clyde C BrownandClaude Opus 5.5 committed 2026-10-24 12:41:48 -06:00
1 parent 61c89b148f
commit 8c45aa359d
1 file changed
+5 -2
+5 -2
View File
@@ -129,11 +129,14 @@ pub(crate) fn one_photo(originals: &Path, settings: &str) -> Vec<Table> {
pub(crate) const ARCHIVE_HEADER: &[u8] = b"LC-LRARCH\0\x01Z";
/// The JSON the import archive at `path` holds, for tests that check what an import kept. The JSON itself is capped
/// at 32 MiB too, so that is the most it can inflate to.
/// at `MAX_ARCHIVE_BYTES` too, so that is the most it can inflate to.
pub(crate) fn read_archive(path: &Path) -> serde_json::Value {
let bytes = std::fs::read(path).unwrap();
let json = bytes.strip_prefix(ARCHIVE_HEADER).unwrap_or_else(|| panic!("{} is not an import archive", path.display()));
serde_json::from_slice(&miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(json, 32 << 20).unwrap()).unwrap()
serde_json::from_slice(
&miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(json, crate::lightroom_archive::MAX_ARCHIVE_BYTES as usize).unwrap(),
)
.unwrap()
}
/// A new, empty folder for one test's catalog.