Skip to content

Commit

Permalink
allow skipping errors while creating snowball archive
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Aug 7, 2023
1 parent c0ea248 commit 79f7676
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/vulncheck.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.20.6 ]
go-version: [ 1.20.7 ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down
10 changes: 10 additions & 0 deletions api-putobject-snowball.go
Expand Up @@ -48,6 +48,10 @@ type SnowballOptions struct {
// Compression will typically reduce memory and network usage,
// Compression can safely be enabled with MinIO hosts.
Compress bool

// SkipErrs if enabled will skip any errors while reading the
// object content while creating the snowball archive
SkipErrs bool
}

// SnowballObject contains information about a single object to be added to the snowball.
Expand Down Expand Up @@ -184,10 +188,16 @@ objectLoop:
n, err := io.Copy(t, obj.Content)
if err != nil {
closeObj()
if opts.SkipErrs {
continue
}
return err
}
if n != obj.Size {
closeObj()
if opts.SkipErrs {
continue
}
return io.ErrUnexpectedEOF
}
closeObj()
Expand Down

0 comments on commit 79f7676

Please sign in to comment.