zip: not a valid zip file

928 views
Skip to first unread message

Ruben Pollan

unread,
Mar 31, 2013, 4:43:23 PM3/31/13
to golan...@googlegroups.com
I'm working on an epub library. An epub file is basically a zip file with a set
of html and xml files.

Trying to uncompress some epub files with the go standard libary "archive/zip" I
got the following error:
zip: not a valid zip file

It can be reproduce with the following code:
http://play.golang.org/p/TACNtNxkXV
Run on this epub:
http://ge.tt/28zbJgc/v/0

Is there any problem with this zip file? I can decompress it with no problems
using "unzip" on GNU/Linux. Is that a known issue? Is there any better zip
library?

Thank you.

--
Rubén Pollán | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.

minux

unread,
Mar 31, 2013, 5:01:55 PM3/31/13
to Ruben Pollan, golan...@googlegroups.com
On Mon, Apr 1, 2013 at 4:43 AM, Ruben Pollan <mes...@sindominio.net> wrote:
> I'm working on an epub library. An epub file is basically a zip file with a set
> of html and xml files.
>
> Trying to uncompress some epub files with the go standard libary "archive/zip" I
> got the following error:
> zip: not a valid zip file
>
> It can be reproduce with the following code:
> http://play.golang.org/p/TACNtNxkXV
> Run on this epub:
> http://ge.tt/28zbJgc/v/0
>
> Is there any problem with this zip file? I can decompress it with no problems
> using "unzip" on GNU/Linux. Is that a known issue? Is there any better zip
> library?
if you use zip -A to clean up the epub, Go's archive/zip will accept it.
i don't have time to take a closer look, but it appears that zip -A simply
strips 772 bytes from the end of the file.

you might want to take a look at the zip specification and determine wether
the original file really is valid zip file, if it's, please file an issue.

Tamás Gulácsi

unread,
Mar 31, 2013, 6:52:34 PM3/31/13
to golan...@googlegroups.com
If zip -A cleans it, than that means some extra bytes after the zip index. The zip spec allows this...

Andrew Gerrand

unread,
Apr 1, 2013, 6:19:02 PM4/1/13
to Tamás Gulácsi, golang-nuts

The archive/zip package should be able to handle at least that much extra data at the end of the file. Please file an issue and include a minimal reproduction case.

Andrew

On 1 Apr 2013 09:52, "Tamás Gulácsi" <tgula...@gmail.com> wrote:
If zip -A cleans it, than that means some extra bytes after the zip index. The zip spec allows this...

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Ruben Pollan

unread,
Apr 6, 2013, 12:12:17 PM4/6/13
to Andrew Gerrand, Tamás Gulácsi, golang-nuts
Quoting Andrew Gerrand (2013-04-02 00:19:02)
> The archive/zip package should be able to handle at least that much extra data
> at the end of the file. Please file an issue and include a minimal reproduction
> case.

I just open an issue:
https://code.google.com/p/go/issues/detail?id=5228
Reply all
Reply to author
Forward
0 new messages