diff options
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/server/filer_server_handlers_write_autochunk.go | 6 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write_upload.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index d2110bccd..494a0f4bf 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -126,6 +126,10 @@ func (fs *FilerServer) doPutAutoChunk(ctx context.Context, w http.ResponseWriter return } +func isAppend(r *http.Request) bool { + return r.URL.Query().Get("op") == "append" +} + func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileName string, contentType string, so *operation.StorageOption, md5bytes []byte, fileChunks []*filer_pb.FileChunk, chunkOffset int64, content []byte) (filerResult *FilerPostResult, replyerr error) { // detect file mode @@ -158,7 +162,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa var entry *filer.Entry var mergedChunks []*filer_pb.FileChunk - isAppend := r.URL.Query().Get("op") == "append" + isAppend := isAppend(r) isOffsetWrite := len(fileChunks) > 0 && fileChunks[0].Offset > 0 // when it is an append if isAppend || isOffsetWrite { diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go index 294a97582..15a4bac33 100644 --- a/weed/server/filer_server_handlers_write_upload.go +++ b/weed/server/filer_server_handlers_write_upload.go @@ -31,8 +31,8 @@ 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) { query := r.URL.Query() - isAppend := query.Get("op") == "append" + isAppend := isAppend(r) if query.Has("offset") { offset := query.Get("offset") offsetInt, err := strconv.ParseInt(offset, 10, 64) |
