mirror of
https://github.com/minio/minio.git
synced 2025-07-15 03:41:53 -04:00
Merge pull request #887 from harshavardhana/fix-encoding-bug-donut
Fix encoding bug in donut during encoding phase
This commit is contained in:
commit
cf0e1a156b
@ -444,7 +444,8 @@ func (b bucket) writeObjectData(k, m uint8, writers []io.WriteCloser, objectData
|
|||||||
var length int
|
var length int
|
||||||
inputData := make([]byte, chunkSize)
|
inputData := make([]byte, chunkSize)
|
||||||
length, e = objectData.Read(inputData)
|
length, e = objectData.Read(inputData)
|
||||||
encodedBlocks, err := encoder.Encode(inputData)
|
if length != 0 {
|
||||||
|
encodedBlocks, err := encoder.Encode(inputData[0:length])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, err.Trace()
|
return 0, 0, err.Trace()
|
||||||
}
|
}
|
||||||
@ -466,6 +467,7 @@ func (b bucket) writeObjectData(k, m uint8, writers []io.WriteCloser, objectData
|
|||||||
totalLength += length
|
totalLength += length
|
||||||
chunkCount = chunkCount + 1
|
chunkCount = chunkCount + 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if e != io.EOF {
|
if e != io.EOF {
|
||||||
return 0, 0, probe.NewError(e)
|
return 0, 0, probe.NewError(e)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -131,7 +130,7 @@ func initSignatureV4(req *http.Request) (*signv4.Signature, *probe.Error) {
|
|||||||
func extractHTTPFormValues(reader *multipart.Reader) (io.Reader, map[string]string, *probe.Error) {
|
func extractHTTPFormValues(reader *multipart.Reader) (io.Reader, map[string]string, *probe.Error) {
|
||||||
/// HTML Form values
|
/// HTML Form values
|
||||||
formValues := make(map[string]string)
|
formValues := make(map[string]string)
|
||||||
filePart := new(bytes.Buffer)
|
var filePart io.Reader
|
||||||
var err error
|
var err error
|
||||||
for err == nil {
|
for err == nil {
|
||||||
var part *multipart.Part
|
var part *multipart.Part
|
||||||
@ -144,11 +143,7 @@ func extractHTTPFormValues(reader *multipart.Reader) (io.Reader, map[string]stri
|
|||||||
}
|
}
|
||||||
formValues[part.FormName()] = string(buffer)
|
formValues[part.FormName()] = string(buffer)
|
||||||
} else {
|
} else {
|
||||||
// FIXME: this will hog memory
|
filePart = part
|
||||||
_, err := io.Copy(filePart, part)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, probe.NewError(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user