Commit b95c4891 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

archive/zip: add docs on type of slashes in paths

Fixes #5307

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8676046
parent d00a646e
...@@ -64,8 +64,15 @@ const ( ...@@ -64,8 +64,15 @@ const (
zip64ExtraId = 0x0001 // zip64 Extended Information Extra Field zip64ExtraId = 0x0001 // zip64 Extended Information Extra Field
) )
// FileHeader describes a file within a zip file.
// See the zip spec for details.
type FileHeader struct { type FileHeader struct {
// Name is the name of the file.
// It must be a relative path: it must not start with a drive
// letter (e.g. C:) or leading slash, and only forward slashes
// are allowed.
Name string Name string
CreatorVersion uint16 CreatorVersion uint16
ReaderVersion uint16 ReaderVersion uint16
Flags uint16 Flags uint16
......
...@@ -163,6 +163,9 @@ func (w *Writer) Close() error { ...@@ -163,6 +163,9 @@ func (w *Writer) Close() error {
// Create adds a file to the zip file using the provided name. // Create adds a file to the zip file using the provided name.
// It returns a Writer to which the file contents should be written. // It returns a Writer to which the file contents should be written.
// The name must be a relative path: it must not start with a drive
// letter (e.g. C:) or leading slash, and only forward slashes are
// allowed.
// The file's contents must be written to the io.Writer before the next // The file's contents must be written to the io.Writer before the next
// call to Create, CreateHeader, or Close. // call to Create, CreateHeader, or Close.
func (w *Writer) Create(name string) (io.Writer, error) { func (w *Writer) Create(name string) (io.Writer, error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment