|
@ -102,12 +102,12 @@ func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWrite |
|
|
md5bytes = md5Hash.Sum(nil) |
|
|
md5bytes = md5Hash.Sum(nil) |
|
|
headerMd5 := r.Header.Get("Content-Md5") |
|
|
headerMd5 := r.Header.Get("Content-Md5") |
|
|
if headerMd5 != "" && !(util.Base64Encode(md5bytes) == headerMd5 || fmt.Sprintf("%x", md5bytes) == headerMd5) { |
|
|
if headerMd5 != "" && !(util.Base64Encode(md5bytes) == headerMd5 || fmt.Sprintf("%x", md5bytes) == headerMd5) { |
|
|
fs.filer.DeleteChunks(fileChunks) |
|
|
|
|
|
|
|
|
fs.filer.DeleteUncommittedChunks(fileChunks) |
|
|
return nil, nil, errors.New("The Content-Md5 you specified did not match what we received.") |
|
|
return nil, nil, errors.New("The Content-Md5 you specified did not match what we received.") |
|
|
} |
|
|
} |
|
|
filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, md5bytes, fileChunks, chunkOffset, smallContent) |
|
|
filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, md5bytes, fileChunks, chunkOffset, smallContent) |
|
|
if replyerr != nil { |
|
|
if replyerr != nil { |
|
|
fs.filer.DeleteChunks(fileChunks) |
|
|
|
|
|
|
|
|
fs.filer.DeleteUncommittedChunks(fileChunks) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return |
|
|
return |
|
@ -129,7 +129,7 @@ func (fs *FilerServer) doPutAutoChunk(ctx context.Context, w http.ResponseWriter |
|
|
md5bytes = md5Hash.Sum(nil) |
|
|
md5bytes = md5Hash.Sum(nil) |
|
|
headerMd5 := r.Header.Get("Content-Md5") |
|
|
headerMd5 := r.Header.Get("Content-Md5") |
|
|
if headerMd5 != "" && !(util.Base64Encode(md5bytes) == headerMd5 || fmt.Sprintf("%x", md5bytes) == headerMd5) { |
|
|
if headerMd5 != "" && !(util.Base64Encode(md5bytes) == headerMd5 || fmt.Sprintf("%x", md5bytes) == headerMd5) { |
|
|
fs.filer.DeleteChunks(fileChunks) |
|
|
|
|
|
|
|
|
fs.filer.DeleteUncommittedChunks(fileChunks) |
|
|
return nil, nil, errors.New("The Content-Md5 you specified did not match what we received.") |
|
|
return nil, nil, errors.New("The Content-Md5 you specified did not match what we received.") |
|
|
} |
|
|
} |
|
|
filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, md5bytes, fileChunks, chunkOffset, smallContent) |
|
|
filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, md5bytes, fileChunks, chunkOffset, smallContent) |
|
|