Skip to content

Commit

Permalink
Snowball: If Modtime unset, use current time (#1763)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Jan 26, 2023
1 parent f54fa21 commit f5f1604
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api-putobject-snowball.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type SnowballObject struct {
Size int64

// Modtime to apply to the object.
// If Modtime is the zero value current time will be used.
ModTime time.Time

// Content of the object.
Expand Down Expand Up @@ -172,6 +173,10 @@ objectLoop:
ModTime: obj.ModTime,
Format: tar.FormatPAX,
}
if header.ModTime.IsZero() {
header.ModTime = time.Now().UTC()
}

if err := t.WriteHeader(&header); err != nil {
closeObj()
return err
Expand Down

0 comments on commit f5f1604

Please sign in to comment.