From 7feb0818ff8b235b02f9d34890b2c07fc81433db Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 10 Nov 2020 18:25:58 -0300 Subject: [PATCH] fix: invalid zip file (#253) Signed-off-by: Carlos Alexandro Becker --- apk/apk_test.go | 6 +++--- deb/deb_test.go | 6 +++--- internal/files/files_test.go | 6 +++--- rpm/rpm_test.go | 6 +++--- testdata/{{file}* => {file}[} | 0 5 files changed, 12 insertions(+), 12 deletions(-) rename testdata/{{file}* => {file}[} (100%) diff --git a/apk/apk_test.go b/apk/apk_test.go index 72dedbd1..1a1a9e95 100644 --- a/apk/apk_test.go +++ b/apk/apk_test.go @@ -306,7 +306,7 @@ func TestDisableGlobbing(t *testing.T) { info := exampleInfo() info.DisableGlobbing = true info.Files = map[string]string{ - "../testdata/{file}*": "/test/{file}*", + "../testdata/{file}[": "/test/{file}[", } size := int64(0) @@ -319,8 +319,8 @@ func TestDisableGlobbing(t *testing.T) { dataTar, err := ioutil.ReadAll(gzr) require.NoError(t, err) - extractedContent := extractFromTar(t, dataTar, "test/{file}*") - actualContent, err := ioutil.ReadFile("../testdata/{file}*") + extractedContent := extractFromTar(t, dataTar, "test/{file}[") + actualContent, err := ioutil.ReadFile("../testdata/{file}[") require.NoError(t, err) require.Equal(t, actualContent, extractedContent) } diff --git a/deb/deb_test.go b/deb/deb_test.go index aa240b71..1996c3be 100644 --- a/deb/deb_test.go +++ b/deb/deb_test.go @@ -777,16 +777,16 @@ func TestDisableGlobbing(t *testing.T) { info := exampleInfo() info.DisableGlobbing = true info.Files = map[string]string{ - "../testdata/{file}*": "/test/{file}*", + "../testdata/{file}[": "/test/{file}[", } dataTarGz, _, _, err := createDataTarGz(info) require.NoError(t, err) - expectedContent, err := ioutil.ReadFile("../testdata/{file}*") + expectedContent, err := ioutil.ReadFile("../testdata/{file}[") require.NoError(t, err) - actualContent, err := extractFileFromTarGz(dataTarGz, "/test/{file}*") + actualContent, err := extractFileFromTarGz(dataTarGz, "/test/{file}[") require.NoError(t, err) assert.Equal(t, expectedContent, actualContent) diff --git a/internal/files/files_test.go b/internal/files/files_test.go index 9644d646..9911f640 100644 --- a/internal/files/files_test.go +++ b/internal/files/files_test.go @@ -42,15 +42,15 @@ func TestListFilesToCopy(t *testing.T) { func TestListFilesToCopyWithAndWithoutGlobbing(t *testing.T) { _, err := Expand(map[string]string{ - "../../testdata/{file}*": "/test/{file}*", + "../../testdata/{file}*": "/test/{file}[", }, false) assert.EqualError(t, err, "glob failed: ../../testdata/{file}*: no matching files") files, err := Expand(map[string]string{ - "../../testdata/{file}*": "/test/{file}*", + "../../testdata/{file}[": "/test/{file}[", }, true) require.NoError(t, err) assert.Equal(t, []FileToCopy{ - {"../../testdata/{file}*", "/test/{file}*"}, + {"../../testdata/{file}[", "/test/{file}["}, }, files) } diff --git a/rpm/rpm_test.go b/rpm/rpm_test.go index 360cd165..6295f5eb 100644 --- a/rpm/rpm_test.go +++ b/rpm/rpm_test.go @@ -647,17 +647,17 @@ func TestDisableGlobbing(t *testing.T) { info := exampleInfo() info.DisableGlobbing = true info.Files = map[string]string{ - "../testdata/{file}*": "/test/{file}*", + "../testdata/{file}[": "/test/{file}[", } var rpmFileBuffer bytes.Buffer err := Default.Package(info, &rpmFileBuffer) require.NoError(t, err) - expectedContent, err := ioutil.ReadFile("../testdata/{file}*") + expectedContent, err := ioutil.ReadFile("../testdata/{file}[") require.NoError(t, err) - actualContent, err := extractFileFromRpm(rpmFileBuffer.Bytes(), "/test/{file}*") + actualContent, err := extractFileFromRpm(rpmFileBuffer.Bytes(), "/test/{file}[") require.NoError(t, err) assert.Equal(t, expectedContent, actualContent) diff --git a/testdata/{file}* b/testdata/{file}[ similarity index 100% rename from testdata/{file}* rename to testdata/{file}[