@@ -31,6 +31,7 @@ import (
3131
3232 "github.com/arduino/arduino-cli/internal/i18n"
3333 paths "github.com/arduino/go-paths-helper"
34+ "github.com/sirupsen/logrus"
3435)
3536
3637// TestLocalArchiveChecksum test if the checksum of the local archive match the checksum of the DownloadResource
@@ -82,20 +83,21 @@ func (r *DownloadResource) TestLocalArchiveChecksum(downloadDir *paths.Path) (bo
8283}
8384
8485// TestLocalArchiveSize test if the local archive size match the DownloadResource size
85- func (r * DownloadResource ) TestLocalArchiveSize (downloadDir * paths.Path ) ( bool , error ) {
86+ func (r * DownloadResource ) TestLocalArchiveSize (downloadDir * paths.Path ) error {
8687 filePath , err := r .ArchivePath (downloadDir )
8788 if err != nil {
88- return false , errors .New (i18n .Tr ("getting archive path: %s" , err ))
89+ return errors .New (i18n .Tr ("getting archive path: %s" , err ))
8990 }
9091 info , err := filePath .Stat ()
9192 if err != nil {
92- return false , errors .New (i18n .Tr ("getting archive info: %s" , err ))
93+ return errors .New (i18n .Tr ("getting archive info: %s" , err ))
9394 }
95+ // If the size do not match, just report a warning and continue
96+ // (the checksum is sufficient to ensure the integrity of the archive)
9497 if info .Size () != r .Size {
95- return false , fmt . Errorf ("%s: %d != %d" , i18n .Tr ("fetched archive size differs from size specified in index" ), info .Size (), r .Size )
98+ logrus . Warningf ("%s: %d != %d" , i18n .Tr ("fetched archive size differs from size specified in index" ), info .Size (), r .Size )
9699 }
97-
98- return true , nil
100+ return nil
99101}
100102
101103// TestLocalArchiveIntegrity checks for integrity of the local archive.
@@ -106,10 +108,8 @@ func (r *DownloadResource) TestLocalArchiveIntegrity(downloadDir *paths.Path) (b
106108 return false , nil
107109 }
108110
109- if ok , err := r .TestLocalArchiveSize (downloadDir ); err != nil {
111+ if err := r .TestLocalArchiveSize (downloadDir ); err != nil {
110112 return false , errors .New (i18n .Tr ("testing archive size: %s" , err ))
111- } else if ! ok {
112- return false , nil
113113 }
114114
115115 ok , err := r .TestLocalArchiveChecksum (downloadDir )
0 commit comments