I am using the C# library DotNetZip (Ionic.Zip and Ionic.Zlib) to generate an ebook from a directory. Directory looks like this:
BookName
|
|___content/
| images/
| css/
| (html pages, .ops, .ncx)
|
|___META-INF/
| container.xml
|
|___mimetype
The code to generate the archive looks like this:
using (ZipFile zip = new ZipFile(pathTemp + ".epub"))
{
zip.RemoveSelectedEntries("*.*");
zip.AddFile(mimetype, "").CompressionLevel = CompressionLevel.None;
zip.AddDirectory(pathTemp + "\\content", "content");
zip.AddDirectory(pathTemp + "\\META-INF", "META-INF");
zip.Save();
}
When I run it through the EPUB Validator, it throws this error:
The mimetype file has an extra field of length 36. The use of the extra field feature of the ZIP format is not permitted for the mimetype file.
I'm not compressing the mimetype file, so I don't know what is happening.
See https://ebooks.stackexchange.com/questions/6258/the-mimetype-file-has-an-extra-field-of-length-n-the-use-of-the-extra-field-fea
I had the same error, after removing an unwanted file from the .epub file which wasn't wanted for the .epub format (META-INF/calibre_bookmarks.txt). After I re-zipped the file, I got the above error message.
zipping with the -X argument:
-X Do not save extra file attributes (Extended Attributes on OS/2,
uid/gid and file times on Unix).
solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With