forked from hashicorp/go-getter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't unpack extended tar headers as regular files
Extended headers should not be extracted as regular files. Most popular tar implementations will create directories as needed, even if they don't exist in the archive. This was already fixed in master, but left the test case for completeness. extended_header.tar contains an global extended header like git uses. implied_dir.tar contains 2 files in multiple directories with no directory entries.
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package getter | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestTar(t *testing.T) { | ||
cases := []TestDecompressCase{ | ||
{ | ||
"extended_header.tar", | ||
true, | ||
false, | ||
[]string{"directory/", "directory/a", "directory/b"}, | ||
"", | ||
}, | ||
{ | ||
"implied_dir.tar", | ||
true, | ||
false, | ||
[]string{"directory/", "directory/sub/", "directory/sub/a", "directory/sub/b"}, | ||
"", | ||
}, | ||
} | ||
|
||
for i, tc := range cases { | ||
cases[i].Input = filepath.Join("./test-fixtures", "decompress-tar", tc.Input) | ||
} | ||
|
||
TestDecompressor(t, new(tarDecompressor), cases) | ||
} |
Binary file not shown.
Binary file not shown.