Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Source content can be nil when updating progress bar #2984

Merged
merged 1 commit into from
Dec 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmd/mirror-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ EXAMPLES:

13. Update 'Cache-Control' header on existing objects.
{{.Prompt}} {{.HelpName}} --attr Cache-Control=max-age=90000,min-fresh=9000 myminio/video-files myminio/video-files

14. Mirror a local folder recursively to Amazon S3 cloud storage and preserve all local file attributes.
{{.Prompt}} {{.HelpName}} -a backup/ s3/archive
{{.Prompt}} {{.HelpName}} -a backup/ s3/archive
`,
}

Expand Down Expand Up @@ -266,7 +266,9 @@ func (mj *mirrorJob) doMirror(ctx context.Context, cancelMirror context.CancelFu
//s For a fake mirror make sure we update respective progress bars
// and accounting readers under relevant conditions.
if mj.isFake {
mj.status.Add(sURLs.SourceContent.Size)
if sURLs.SourceContent != nil {
mj.status.Add(sURLs.SourceContent.Size)
}
mj.status.Update()
return sURLs.WithError(nil)
}
Expand Down Expand Up @@ -544,7 +546,9 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
}
}

mj.status.Add(sURLs.SourceContent.Size)
if sURLs.SourceContent != nil {
mj.status.Add(sURLs.SourceContent.Size)
}
mj.status.SetTotal(mj.status.Get()).Update()
mj.status.AddCounts(1)

Expand Down