Skip to content

Commit bd740cc

Browse files
committed
fixup! TestIsArchivePathInvalidFile: avoid shelling out
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 3115622 commit bd740cc

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

archive_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,6 @@ func createTarFromFiles(t *testing.T, tarPath string, files ...string) {
7777
assert.NilError(t, f.Close())
7878
}
7979

80-
// toUnixPath converts the given path to a unix-path, using forward-slashes, and
81-
// with the drive-letter replaced (e.g. "C:\temp\file.txt" becomes "/c/temp/file.txt").
82-
// It is a no-op on non-Windows platforms.
83-
func toUnixPath(p string) string {
84-
if runtime.GOOS != "windows" {
85-
return p
86-
}
87-
p = filepath.ToSlash(p)
88-
89-
vol := strings.TrimPrefix(filepath.VolumeName(p), "//?/")
90-
if len(vol) == 2 && vol[1] == ':' {
91-
return "/" + strings.ToLower(vol[:1]) + p[len(filepath.VolumeName(p)):]
92-
}
93-
return p
94-
}
95-
9680
func TestIsArchivePathDir(t *testing.T) {
9781
tmp := t.TempDir()
9882
assert.NilError(t, os.Mkdir(filepath.Join(tmp, "archivedir"), 0o755))

0 commit comments

Comments
 (0)