Skip to content

Commit a748190

Browse files
authored
Set Content-Length for blob uploads (#1781)
Sometimes we know it, sometimes we don't. When we do, set it.
1 parent 190ad0e commit a748190

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/v1/remote/write.go

+5
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ func (w *writer) streamBlob(ctx context.Context, layer v1.Layer, streamLocation
280280
if _, ok := layer.(*stream.Layer); !ok {
281281
// We can't retry streaming layers.
282282
req.GetBody = getBody
283+
284+
// If we know the size, set it.
285+
if size, err := layer.Size(); err == nil {
286+
req.ContentLength = size
287+
}
283288
}
284289
req.Header.Set("Content-Type", "application/octet-stream")
285290

0 commit comments

Comments
 (0)