Skip to content

Commit

Permalink
Do not skip platform index loading if size is invalid or missing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jan 13, 2025
1 parent 2925682 commit be0b725
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/arduino/cores/packageindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ package packageindex

import (
"encoding/json"
"errors"
"fmt"
"slices"

"github.com/arduino/arduino-cli/internal/arduino/cores"
"github.com/arduino/arduino-cli/internal/arduino/resources"
"github.com/arduino/arduino-cli/internal/arduino/security"
"github.com/arduino/arduino-cli/internal/i18n"
"github.com/arduino/go-paths-helper"
easyjson "github.com/mailru/easyjson"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -273,14 +271,15 @@ func (inPlatformRelease indexPlatformRelease) extractPlatformIn(outPackage *core
outPlatform.Deprecated = inPlatformRelease.Deprecated
}

size, err := inPlatformRelease.Size.Int64()
if err != nil {
return errors.New(i18n.Tr("invalid platform archive size: %s", err))
}
outPlatformRelease := outPlatform.GetOrCreateRelease(inPlatformRelease.Version)
outPlatformRelease.Name = inPlatformRelease.Name
outPlatformRelease.Category = inPlatformRelease.Category
outPlatformRelease.IsTrusted = trusted
size, err := inPlatformRelease.Size.Int64()
if err != nil {
logrus.Warningf("invalid platform %s archive size: %s", outPlatformRelease, err)
size = 0
}
outPlatformRelease.Resource = &resources.DownloadResource{
ArchiveFileName: inPlatformRelease.ArchiveFileName,
Checksum: inPlatformRelease.Checksum,
Expand Down

0 comments on commit be0b725

Please sign in to comment.