fix aws style Etag for chunks

This commit is contained in:
Konstantin Lebedev committed 2021-04-28 22:28:05 +05:00
1 parent ccbe02218a
commit c2269123d3
3 files changed
+9 -5

No files matched your search

@@ -1,6 +1,7 @@
package weed_server
import (
"bytes"
"crypto/md5"
"hash"
"io"
@@ -71,6 +72,11 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
if uploadResult.Size == 0 {
break
}
uploadedMd5 := util.Base64Md5ToBytes(uploadResult.ContentMd5)
readedMd5 := md5Hash.Sum(nil)
if !bytes.Equal(uploadedMd5, readedMd5) {
glog.Errorf("md5 %x does not match %x uploaded chunk %s to the volume server", readedMd5, uploadedMd5, uploadResult.Name)
}
// Save to chunk manifest structure
fileChunks = append(fileChunks, uploadResult.ToPbFileChunk(fileId, chunkOffset))