change method to check index.json existance

Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com>
Signed-off-by: Seyed Mohammad Mahdi Hatami <62210297+smmhatami@users.noreply.github.com>
pull/12151/head
Seyed Mohammad Mahdi Hatami 2 years ago committed by GitHub
parent 546d071f4f
commit d40f01578a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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. // This will fail if API Version is not set (ErrNoAPIVersion) or if the unmarshal fails.
func loadIndex(data []byte, source string) (*IndexFile, error) { func loadIndex(data []byte, source string) (*IndexFile, error) {
i := &IndexFile{} 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 // TODO : add error for empty json
if len(data) == 0 { if len(data) == 0 {

Loading…
Cancel
Save