summaryrefslogtreecommitdiff
path: root/zip
diff options
context:
space:
mode:
Diffstat (limited to 'zip')
-rw-r--r--zip/zip.go3
-rw-r--r--zip/zip_test.go14
2 files changed, 13 insertions, 4 deletions
diff --git a/zip/zip.go b/zip/zip.go
index cb85f5ced..f7313291c 100644
--- a/zip/zip.go
+++ b/zip/zip.go
@@ -172,6 +172,9 @@ func (b *FileArgsBuilder) RspFile(name string) *FileArgsBuilder {
arg := b.state
arg.SourceFiles = ReadRespFile(list)
+ for i := range arg.SourceFiles {
+ arg.SourceFiles[i] = pathtools.MatchEscape(arg.SourceFiles[i])
+ }
b.fileArgs = append(b.fileArgs, arg)
return b
}
diff --git a/zip/zip_test.go b/zip/zip_test.go
index a16e09286..b456ef8f2 100644
--- a/zip/zip_test.go
+++ b/zip/zip_test.go
@@ -46,13 +46,14 @@ var mockFs = pathtools.MockFs(map[string][]byte{
"dangling -> missing": nil,
"a/a/d -> b": nil,
"c": fileC,
- "l_nl": []byte("a/a/a\na/a/b\nc\n"),
- "l_sp": []byte("a/a/a a/a/b c"),
+ "l_nl": []byte("a/a/a\na/a/b\nc\n\\[\n"),
+ "l_sp": []byte("a/a/a a/a/b c \\["),
"l2": []byte("missing\n"),
- "rsp": []byte("'a/a/a'\na/a/b\n'@'\n'foo'\\''bar'"),
+ "rsp": []byte("'a/a/a'\na/a/b\n'@'\n'foo'\\''bar'\n'['"),
"@ -> c": nil,
"foo'bar -> c": nil,
"manifest.txt": fileCustomManifest,
+ "[": fileEmpty,
})
func fh(name string, contents []byte, method uint16) zip.FileHeader {
@@ -127,13 +128,15 @@ func TestZip(t *testing.T) {
args: fileArgsBuilder().
File("a/a/a").
File("a/a/b").
- File("c"),
+ File("c").
+ File(`\[`),
compressionLevel: 9,
files: []zip.FileHeader{
fh("a/a/a", fileA, zip.Deflate),
fh("a/a/b", fileB, zip.Deflate),
fh("c", fileC, zip.Deflate),
+ fh("[", fileEmpty, zip.Store),
},
},
{
@@ -235,6 +238,7 @@ func TestZip(t *testing.T) {
fh("a/a/a", fileA, zip.Deflate),
fh("a/a/b", fileB, zip.Deflate),
fh("c", fileC, zip.Deflate),
+ fh("[", fileEmpty, zip.Store),
},
},
{
@@ -247,6 +251,7 @@ func TestZip(t *testing.T) {
fh("a/a/a", fileA, zip.Deflate),
fh("a/a/b", fileB, zip.Deflate),
fh("c", fileC, zip.Deflate),
+ fh("[", fileEmpty, zip.Store),
},
},
{
@@ -260,6 +265,7 @@ func TestZip(t *testing.T) {
fh("a/a/b", fileB, zip.Deflate),
fh("@", fileC, zip.Deflate),
fh("foo'bar", fileC, zip.Deflate),
+ fh("[", fileEmpty, zip.Store),
},
},
{