Skip to content

Commit

Permalink
Set Content-Length for blob uploads (#1781)
Browse files Browse the repository at this point in the history
Sometimes we know it, sometimes we don't. When we do, set it.
  • Loading branch information
jonjohnsonjr authored Sep 5, 2023
1 parent 190ad0e commit a748190
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/v1/remote/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ func (w *writer) streamBlob(ctx context.Context, layer v1.Layer, streamLocation
if _, ok := layer.(*stream.Layer); !ok {
// We can't retry streaming layers.
req.GetBody = getBody

// If we know the size, set it.
if size, err := layer.Size(); err == nil {
req.ContentLength = size
}
}
req.Header.Set("Content-Type", "application/octet-stream")

Expand Down

0 comments on commit a748190

Please sign in to comment.