mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-25 06:20:42 +01:00
filer: also honor request-level Content-Md5 in format ingest
This commit is contained in:
1 parent
19d7c0224b
commit
b95b7f5761
1 file changed
+5
-1
@@ -200,7 +200,11 @@ func (fs *FilerServer) formatIngest(ctx context.Context, w http.ResponseWriter,
|
||||
writeJsonError(w, r, http.StatusInternalServerError, uploadErr)
|
||||
return
|
||||
}
|
||||
if expectedMd5 := mediaPart.Header.Get("Content-Md5"); expectedMd5 != "" {
|
||||
expectedMd5 := mediaPart.Header.Get("Content-Md5")
|
||||
if expectedMd5 == "" {
|
||||
expectedMd5 = r.Header.Get("Content-Md5")
|
||||
}
|
||||
if expectedMd5 != "" {
|
||||
if md5bytes := md5Hash.Sum(nil); util.Base64Encode(md5bytes) != expectedMd5 && fmt.Sprintf("%x", md5bytes) != expectedMd5 {
|
||||
cleanup()
|
||||
writeJsonError(w, r, http.StatusBadRequest, errors.New(constants.ErrMsgBadDigest))
|
||||
|
||||
Reference in new issue
Block a user