fix
This commit is contained in:
@@ -134,9 +134,11 @@ func (c *Client) streamToS3(snapshot *zfs.Dataset, uploadURL, storageKey string)
|
||||
gzWriter := gzip.NewWriter(pw)
|
||||
|
||||
go func() {
|
||||
defer pw.Close()
|
||||
defer gzWriter.Close()
|
||||
// Copy zfs output to gzip writer
|
||||
io.Copy(gzWriter, zfsOut)
|
||||
// Close gzip writer first to flush footer, then close pipe
|
||||
gzWriter.Close()
|
||||
pw.Close()
|
||||
}()
|
||||
|
||||
reader = pr
|
||||
|
||||
@@ -222,9 +222,11 @@ func (c *Client) streamIncrementalToS3(snapshot *zfs.Dataset, base, uploadURL, s
|
||||
gzWriter := gzip.NewWriter(pw)
|
||||
|
||||
go func() {
|
||||
defer pw.Close()
|
||||
defer gzWriter.Close()
|
||||
// Copy zfs output to gzip writer
|
||||
io.Copy(gzWriter, zfsOut)
|
||||
// Close gzip writer first to flush footer, then close pipe
|
||||
gzWriter.Close()
|
||||
pw.Close()
|
||||
}()
|
||||
|
||||
reader = pr
|
||||
|
||||
@@ -346,9 +346,11 @@ func (s *Server) HandleUploadStream(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := context.Background()
|
||||
|
||||
// Upload to S3
|
||||
// When using chunked transfer (io.Pipe), ContentLength is -1
|
||||
// MinIO requires -1 for unknown size to use streaming upload
|
||||
size := r.ContentLength
|
||||
if size < 0 {
|
||||
size = 0
|
||||
size = -1 // Use streaming upload for unknown size
|
||||
}
|
||||
|
||||
if err := s.s3Backend.Upload(ctx, storageKey, r.Body, size); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user