mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Implement ignore checksum mismatch
Also, update "pkg/errors" library.
This commit is contained in:
+6
-4
@@ -31,7 +31,6 @@ var (
|
||||
|
||||
// NewGrabDownloader creates new expected downloader
|
||||
func NewGrabDownloader(downLimit int64, maxTries int, progress aptly.Progress) *GrabDownloader {
|
||||
// TODO rate limiting and progress
|
||||
client := grab.NewClient()
|
||||
return &GrabDownloader{
|
||||
client: client,
|
||||
@@ -70,7 +69,6 @@ func (d *GrabDownloader) DownloadWithChecksum(ctx context.Context, url string, d
|
||||
}
|
||||
|
||||
func (d *GrabDownloader) log(msg string, a ...interface{}) {
|
||||
// TODO don't long to stdout
|
||||
fmt.Printf(msg, a...)
|
||||
if d.progress != nil {
|
||||
d.progress.Printf(msg, a...)
|
||||
@@ -136,8 +134,12 @@ Loop:
|
||||
break Loop
|
||||
}
|
||||
}
|
||||
// TODO ignoreMismatch
|
||||
return resp.Err()
|
||||
err = resp.Err()
|
||||
if err != nil && errors.Is(err, grab.ErrBadChecksum) && ignoreMismatch {
|
||||
fmt.Printf("Ignoring checksum mismatch for %s\n", url)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *GrabDownloader) GetProgress() aptly.Progress {
|
||||
|
||||
Reference in New Issue
Block a user