Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1583929

Browse files
cmaglieumbynos
andcommitted
Apply suggestions from code review
Co-authored-by: Umberto Baldi <34278123+umbynos@users.noreply.github.com>
1 parent a5a910e commit 1583929

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎arduino/resources/index.go‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package resources
1717

1818
import (
1919
"context"
20-
"errors"
2120
"net/url"
2221
"path"
2322
"strings"
@@ -28,6 +27,7 @@ import (
2827
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2928
"github.com/arduino/go-paths-helper"
3029
"github.com/codeclysm/extract/v3"
30+
"github.com/sirupsen/logrus"
3131
"go.bug.st/downloader/v2"
3232
)
3333

@@ -68,12 +68,12 @@ func (res *IndexResource) Download(destDir *paths.Path, downloadCB rpc.DownloadP
6868
signatureFileName := indexFileName + ".sig"
6969
signaturePath = destDir.Join(signatureFileName)
7070

71-
// .tar archive may contain both index and signature
71+
// .tar.bz2 archive may contain both index and signature
7272

7373
// Extract archive in a tmp/archive subdirectory
7474
f, err := tmpIndexPath.Open()
7575
if err != nil {
76-
return &arduino.PermissionDeniedError{Message: tr("Error extracting %s", tmpIndexPath), Cause: err}
76+
return &arduino.PermissionDeniedError{Message: tr("Error opening %s", tmpIndexPath), Cause: err}
7777
}
7878
defer f.Close()
7979
tmpArchivePath := tmp.Join("archive")
@@ -85,14 +85,15 @@ func (res *IndexResource) Download(destDir *paths.Path, downloadCB rpc.DownloadP
8585
// Look for index.json
8686
tmpIndexPath = tmpArchivePath.Join(indexFileName)
8787
if !tmpIndexPath.Exist() {
88-
err := errors.New(tr("%s not found", indexFileName))
89-
return &arduino.FailedDownloadError{Message: tr("Invalid index archive"), Cause: err}
88+
return &arduino.NotFoundError{Message: tr("Invalid archive: file %{1}s not found in archive %{2}s", indexFileName, tmpArchivePath.Base())}
9089
}
9190

9291
// Look for signature
9392
if t := tmpArchivePath.Join(signatureFileName); t.Exist() {
9493
tmpSignaturePath = t
9594
hasSignature = true
95+
} else {
96+
logrus.Infof("No signature %s found in package index archive %s", signatureFileName, tmpArchivePath.Base())
9697
}
9798
} else if strings.HasSuffix(indexFileName, ".gz") {
9899
indexFileName = strings.TrimSuffix(indexFileName, ".gz") // == package_index.json

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /