mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-28 09:19:25 +01:00
#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:
1 parent
61c89b148f
commit
8c45aa359d
1 file changed
+5
-2
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user