Skip to content
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

archive/zip: support "end of central directory record comment" (not file header comment) #21634

yanolab opened this issue Aug 26, 2017 · 4 comments


Copy link

@yanolab yanolab commented Aug 26, 2017

ZIP formart has 2 types comment.
First, Central directory file header comment. This is already supported.
Second, End of central directory record comment. Read this comment is supported, but Write is not supported yet.

(more detail of zip format, see also:

Not supported go source code is bellow.

I think following commit is mistake, because file header comment had been supported since Go1 released.

I propose to support "end of central directory record comment".


Add SetComment method to zip.Writer, such as bellow.

def (w *Writer) SetComment(c string) error

I will send patch if this proposal is acceptable.

Copy link

@dsnet dsnet commented Aug 26, 2017

For symmetry with Reader, it is probably better to add a Writer.Comment field with the documentation that it must be set before Writer.Close is called.

But the feature request sounds good to me.

@dsnet dsnet added this to the Go1.10 milestone Aug 26, 2017
Copy link
Contributor Author

@yanolab yanolab commented Aug 26, 2017

Thank you for your reply.
Certainly, you're right that for symmetry.
I'll add a field with the document.
However, I think Reader.Comment should not be settable.
I wonder why Reader.Comment is a settable field.

Copy link

@gopherbot gopherbot commented Aug 26, 2017

Change mentions this issue: archive/zip: support "end of central directory record comment"

@gopherbot gopherbot closed this in fda8269 Aug 31, 2017
Copy link

@mattn mattn commented Sep 26, 2017

If the magic number 'PK..' is in the comment as likely as 'end of central directory record comment', I wonder extract is intended.

@golang golang locked and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.