diff options
author | Slack Coder <slackcoder@server.ky> | 2022-04-13 11:17:03 -0500 |
---|---|---|
committer | Slack Coder <slackcoder@server.ky> | 2022-04-13 11:17:03 -0500 |
commit | bb5a1e7b515391888b917b597b7595566b5a22de (patch) | |
tree | 863a05f906c2331f999b320d25bb74f73fdb6b52 | |
parent | 77bea528f8e070a8bab09881f83d2f03e88f08a4 (diff) | |
download | pkgtools-go-bb5a1e7b515391888b917b597b7595566b5a22de.tar.xz |
installpkg: avoid panic when no extension is given
-rw-r--r-- | pkgtools.go | 6 |
1 files changed, 5 insertions, 1 deletions
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 |