aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filechunks.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-04-28 10:37:18 -0700
committerGitHub <noreply@github.com>2021-04-28 10:37:18 -0700
commitef94ff6837fe6e5700ec6cc7b5098735752fd9cf (patch)
tree1642bdcfb53bc6a3f45ab5f836ac4e098ced516d /weed/filer/filechunks.go
parent8ae3ea4b1de528f809eadaaef1af19e46e7b3749 (diff)
parentc2269123d3e8de2ea659a87712cc44dcdc4b636b (diff)
downloadseaweedfs-ef94ff6837fe6e5700ec6cc7b5098735752fd9cf.tar.xz
seaweedfs-ef94ff6837fe6e5700ec6cc7b5098735752fd9cf.zip
Merge pull request #2035 from kmlebedev/fix_chunks_etag
fix aws style Etag for chunks
Diffstat (limited to 'weed/filer/filechunks.go')
-rw-r--r--weed/filer/filechunks.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go
index 68f308a51..346eb3cfb 100644
--- a/weed/filer/filechunks.go
+++ b/weed/filer/filechunks.go
@@ -2,7 +2,6 @@ package filer
import (
"bytes"
- "encoding/hex"
"fmt"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"math"
@@ -43,12 +42,11 @@ func ETagEntry(entry *Entry) (etag string) {
func ETagChunks(chunks []*filer_pb.FileChunk) (etag string) {
if len(chunks) == 1 {
- return chunks[0].ETag
+ return fmt.Sprintf("%x", util.Base64Md5ToBytes(chunks[0].ETag))
}
md5_digests := [][]byte{}
for _, c := range chunks {
- md5_decoded, _ := hex.DecodeString(c.ETag)
- md5_digests = append(md5_digests, md5_decoded)
+ md5_digests = append(md5_digests, util.Base64Md5ToBytes(c.ETag))
}
return fmt.Sprintf("%x-%d", util.Md5(bytes.Join(md5_digests, nil)), len(chunks))
}