summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/rb/archive.go
diff options
context:
space:
mode:
authorKonrad Bańka <k.banka@samsung.com>2020-03-10 06:43:44 +0100
committerKonrad Bańka <k.banka@samsung.com>2020-03-10 13:58:39 +0100
commit251c38778c0c499cae61383720dd8b053b16b87e (patch)
treef9f6f7a36c5c2b54c61b0dd3ad376756186be286 /src/k8splugin/internal/rb/archive.go
parent42c5cef605d1bade236d64c2d73a062f3f935456 (diff)
Handle uncommon format of proper tar archive
Provide proper handling of tar archives containing "current directory", but stored in format: ``` . file2.txt dir1/ dir1/file1.txt ``` instead of typical: ``` ./ ./file2.txt ./dir1/ ./dir1/file1.txt ``` Issue-ID: MULTICLOUD-1025 Signed-off-by: Konrad Bańka <k.banka@samsung.com> Change-Id: Ideffd019255a9f2d029527066e5a6a03d45a2d7b
Diffstat (limited to 'src/k8splugin/internal/rb/archive.go')
-rw-r--r--src/k8splugin/internal/rb/archive.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/k8splugin/internal/rb/archive.go b/src/k8splugin/internal/rb/archive.go
index c0753134..267c7cd2 100644
--- a/src/k8splugin/internal/rb/archive.go
+++ b/src/k8splugin/internal/rb/archive.go
@@ -115,6 +115,10 @@ func ExtractTarBall(r io.Reader) (string, error) {
}
}
case tar.TypeReg:
+ if target == outDir { // Handle '.' substituted to '' entry
+ continue
+ }
+
err = utils.EnsureDirectory(target)
if err != nil {
return "", pkgerrors.Wrap(err, "Creating Directory")