diff options
| author | chrislu <chris.lu@gmail.com> | 2024-09-29 20:47:16 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-09-29 20:47:16 -0700 |
| commit | 190b2fc27637017cdd075331fd04b8cb0e5879b7 (patch) | |
| tree | 93db54c4ad83af2b09eb7862380b8c634154e203 /weed/server/filer_server_handlers_write_upload.go | |
| parent | 8111ec13bd06e4a9142a87640986de8c41d4b75a (diff) | |
| parent | 20929f2a5753a04385be2378e698c8df762b3256 (diff) | |
| download | seaweedfs-origin/mq2.tar.xz seaweedfs-origin/mq2.zip | |
Merge branch 'master' into mq2origin/mq2
Diffstat (limited to 'weed/server/filer_server_handlers_write_upload.go')
| -rw-r--r-- | weed/server/filer_server_handlers_write_upload.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go index d0d1575cf..a08d5efe0 100644 --- a/weed/server/filer_server_handlers_write_upload.go +++ b/weed/server/filer_server_handlers_write_upload.go @@ -27,7 +27,7 @@ var bufPool = sync.Pool{ }, } -func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) (fileChunks []*filer_pb.FileChunk, md5Hash hash.Hash, chunkOffset int64, uploadErr error, smallContent []byte) { +func (fs *FilerServer) uploadRequestToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) (fileChunks []*filer_pb.FileChunk, md5Hash hash.Hash, chunkOffset int64, uploadErr error, smallContent []byte) { query := r.URL.Query() isAppend := isAppend(r) @@ -45,7 +45,13 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque chunkOffset = offsetInt } + return fs.uploadReaderToChunks(reader, chunkOffset, chunkSize, fileName, contentType, isAppend, so) +} + +func (fs *FilerServer) uploadReaderToChunks(reader io.Reader, startOffset int64, chunkSize int32, fileName, contentType string, isAppend bool, so *operation.StorageOption) (fileChunks []*filer_pb.FileChunk, md5Hash hash.Hash, chunkOffset int64, uploadErr error, smallContent []byte) { + md5Hash = md5.New() + chunkOffset = startOffset var partReader = io.NopCloser(io.TeeReader(reader, md5Hash)) var wg sync.WaitGroup |
