The mimetype file has an extra field of length n. The use of the extra field feature of the ZIP format is not permitted for the mimetype file

随声附和 提交于 2019-12-12 18:33:03

问题


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.


回答1:


Probably it has something to do with storing dates - the docs mention "extra field" in the description of this feature. Try specifying EmitTimesInWindowsFormatWhenSaving = false (its true by default) and see if it resolves your issue.




回答2:


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.



来源:https://stackoverflow.com/questions/33726113/the-mimetype-file-has-an-extra-field-of-length-n-the-use-of-the-extra-field-fea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!