From bb5a1e7b515391888b917b597b7595566b5a22de Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Wed, 13 Apr 2022 11:17:03 -0500 Subject: installpkg: avoid panic when no extension is given --- pkgtools.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgtools.go b/pkgtools.go index 350ab6a..aaffb75 100644 --- a/pkgtools.go +++ b/pkgtools.go @@ -224,7 +224,11 @@ var _ ArchiveReader = (*SlackwarePkg)(nil) func OpenSlackwarePkg(fp string) (*SlackwarePkg, error) { var pkg SlackwarePkg var err error - pkg.Format = PackageType(filepath.Ext(fp)[1:]) + + if v := filepath.Ext(fp); len(v) > 0 { + pkg.Format = PackageType(filepath.Ext(fp)[1:]) + } + pkg.file, err = os.Open(fp) if err != nil { return nil, err -- cgit v1.2.3