Strip extended-timestap extra block in zip2zip.
The extended-timestap extra block changes between Local File Header and Central Directory. We have to strip it out to avoid mis-filling during zip2zip. Bug: b/65455145 Test: add unit-test. Change-Id: I17e3f6c10fd6a068019620b4426f6042f6fac317
This commit is contained in:
7
third_party/zip/android_test.go
vendored
7
third_party/zip/android_test.go
vendored
@@ -59,11 +59,16 @@ var stripZip64Testcases = []struct {
|
||||
in: []byte{0, 0, 8, 0, 0, 0},
|
||||
out: []byte{0, 0, 8, 0, 0, 0},
|
||||
},
|
||||
{
|
||||
name: "zip64 extra and extended-timestamp extra and valid non-zip64 extra",
|
||||
in: []byte{1, 0, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 85, 84, 5, 0, 1, 1, 2, 3, 4, 2, 0, 0, 0},
|
||||
out: []byte{2, 0, 0, 0},
|
||||
},
|
||||
}
|
||||
|
||||
func TestStripZip64Extras(t *testing.T) {
|
||||
for _, testcase := range stripZip64Testcases {
|
||||
got := stripZip64Extras(testcase.in)
|
||||
got := stripExtras(testcase.in)
|
||||
if !bytes.Equal(got, testcase.out) {
|
||||
t.Errorf("Failed testcase %s\ninput: %v\n want: %v\n got: %v\n", testcase.name, testcase.in, testcase.out, got)
|
||||
}
|
||||
|
Reference in New Issue
Block a user