-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large zip file cannot be read by Excel #100
Comments
Based on the analysis in zip-rs/zip-old#388 the issue is that the My proposed workaround was: diff --git a/src/types.rs b/src/types.rs
index c3d0a45..e2f44d4 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -272,7 +272,10 @@ impl TryFrom<OffsetDateTime> for DateTime {
}
}
+#[cfg(feature = "bzip2")]
pub const DEFAULT_VERSION: u8 = 46;
+#[cfg(not(feature = "bzip2"))]
+pub const DEFAULT_VERSION: u8 = 45;
/// A type like `AtomicU64` except it implements `Clone` and has predefined
/// ordering. I can submit a PR for that if you think it is reasonable. |
Yes please; I'll have to look up what other software DEFAULT_VERSION affects. Thanks for migrating this issue and closing the original; it helps get the old repo ready for archiving. |
Ok, looks like we may need different version numbers according to the compression and encryption we're actually using for each file, not just what feature flags we're built with. See APPNOTE 4.4.3.2. For example, we'll need to set 51 for AES and 63 for LZMA. |
I've implemented this myself, with all the features for which APPNOTE 4.4.3.2 specifies a minimum version. (Not sure what the correct version is for Zstandard, because APPNOTE doesn't say.) |
Thanks for that. I'll rerun the test case for this later and let you know. |
Apologies, it took me a while to test this and unfortunately it doesn't fix the issue. I'll go over the use case again for clarity. I maintain If the follow Lines 1405 to 1417 in 6296235
This causes the error shown above when Excel tries to load the file. If it is changed to 45 then everything works as expected. In your patch c2fe207 you add enhanced logic to determine I tested with zip.rs v2.0.0 released today (well done). |
…ersion-made-by could be lower than that (#100)
…ersion-made-by could be lower than that (#100)
@jmcnamara I believe this will be fixed when e6b2290 is released as part of version 2.1.0 tonight. Other commits that may be essential to the solution are cda4712, 0636bd7, f90bdf7 (in rare corner cases) and 3afe549. If I'm wrong, could you please reopen this issue and provide an example of a v2.1.0 or newer output that Excel fails to process? |
@Pr0methean I don't think any of those fix the issue. The files that demonstrate this issue are too big (250MB) to upload to GitHub but there is an example in the first comment of this issue from the original reporters repo: Bad file: basic-full.xlsx The issue seems to be in the Central Directly End block of the file which for the file above is the following from
Excel has an issue with the Note, the Created Zip Spec field doesn't have any effect on this. |
Update, maybe this is fixed on main. I was looking at a version of the code that was slightly out of date. Let me recheck... |
Sorry for the noise earlier. I reran with the latest main/v2.1.0 and it Excel can now open the file. For what it is worth here is the Central Directly End block:
Separate question, in this case should the Extract Zip Spec flag be 45 since there are more that 64k files or does that rely on also setting |
Thanks for taking over maintainership of zip.rs. This is a duplicate of an issue that I raised against the older version: zip-rs/zip-old#388
I have a library call
rust_xlsxwriter
that useszip.rs
to create xlsx files.The crate is reasonably well used and to date I haven't had any issues from Excel, either personally or from end users.
However, one user who is creating large (but not
large_file
large) 400MB files with lots of images reported an issue with the following file:Bad file: basic-full.xlsx
Excel complains about this almost immediately when it tries to open it:
I don't see any issues in the zipped XML data (the content) and if I unzip and rezip the file then Excel can open it:
Good file: basic-rezip.xlsx
Also, a Microsoft Open XML SDK validation tool complains about the zip file when I try to open the bad file:
So it looks to me like there is an issue with the zip container.
The bad file above was created with
zip.rs
v0.6.4 but I get the same result with v0.6.6. See the following for additional details: jmcnamara/rust_xlsxwriter#51 Also, I'm second guessing that the issue is with large files. It could be related to the number of files in the zip: 87814.The file was created with the following zip.rs options:
And the following dependency in Cargo.toml:
Turning on the
large_file
ZIP64 option doesn't help.The text was updated successfully, but these errors were encountered: