diff --git a/crates/formats/src/project_file/mod.rs b/crates/formats/src/project_file/mod.rs index 92f6ca8a..3319c4f0 100644 --- a/crates/formats/src/project_file/mod.rs +++ b/crates/formats/src/project_file/mod.rs @@ -147,7 +147,7 @@ fn check_loadable(pf: &ProjectFile, limit: u64) -> Result<()> { if size > limit { let gib = |b: u64| b as f64 / (1u64 << 30) as f64; return Err(FormatError::TooLarge(format!( - "the project holds {:.2} GiB of data once unpacked, but TextureCraft opens project files only up to {:.2} GiB, so nothing was saved and an existing file is unchanged. \ + "the project holds {:.2} GiB ({size} bytes) of data once unpacked, but TextureCraft opens project files only up to {:.2} GiB ({limit} bytes), so nothing was saved and an existing file is unchanged. \ Remove paint layers or baked maps to make it smaller", gib(size), gib(limit) diff --git a/crates/formats/src/project_file/tests.rs b/crates/formats/src/project_file/tests.rs index b16d2f02..074566bf 100644 --- a/crates/formats/src/project_file/tests.rs +++ b/crates/formats/src/project_file/tests.rs @@ -358,6 +358,9 @@ fn a_project_too_big_to_reopen_is_not_saved() { let err = check_loadable(&s.pf, size - 1).unwrap_err(); assert!(matches!(err, FormatError::TooLarge(_))); assert!(err.to_string().contains("nothing was saved"), "{err}"); + // Exact byte counts: a size just over the limit does not read as the limit. + let msg = err.to_string(); + assert!(msg.contains(&format!("({size} bytes)")) && msg.contains(&format!("({} bytes)", size - 1)), "{msg}"); } #[cfg(not(target_arch = "wasm32"))]