From d40f01578ab6060464887b6341be65d5335ac789 Mon Sep 17 00:00:00 2001 From: Seyed Mohammad Mahdi Hatami <62210297+smmhatami@users.noreply.github.com> Date: Thu, 29 Jun 2023 07:48:27 +0330 Subject: [PATCH] change method to check index.json existance Co-authored-by: Hidde Beydals Signed-off-by: Seyed Mohammad Mahdi Hatami <62210297+smmhatami@users.noreply.github.com> --- pkg/repo/index.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 85783e4a3..599759e70 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -334,7 +334,10 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) { // This will fail if API Version is not set (ErrNoAPIVersion) or if the unmarshal fails. func loadIndex(data []byte, source string) (*IndexFile, error) { i := &IndexFile{} - isjson := strings.HasSuffix(source, ".json") + var isJSON bool + if fileExt := filepath.Ext(source); fileExt == ".json" { + isJSON = true + } // TODO : add error for empty json if len(data) == 0 {