|
@ -1,6 +1,7 @@ |
|
|
package weed_server |
|
|
package weed_server |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"bytes" |
|
|
"context" |
|
|
"context" |
|
|
"fmt" |
|
|
"fmt" |
|
|
//"github.com/seaweedfs/seaweedfs/weed/s3api"
|
|
|
//"github.com/seaweedfs/seaweedfs/weed/s3api"
|
|
@ -64,7 +65,6 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r * |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWriter, r *http.Request, chunkSize int32, contentLength int64, so *operation.StorageOption) (filerResult *FilerPostResult, md5bytes []byte, replyerr error) { |
|
|
func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWriter, r *http.Request, chunkSize int32, contentLength int64, so *operation.StorageOption) (filerResult *FilerPostResult, md5bytes []byte, replyerr error) { |
|
|
|
|
|
|
|
|
multipartReader, multipartReaderErr := r.MultipartReader() |
|
|
multipartReader, multipartReaderErr := r.MultipartReader() |
|
|
if multipartReaderErr != nil { |
|
|
if multipartReaderErr != nil { |
|
|
return nil, nil, multipartReaderErr |
|
|
return nil, nil, multipartReaderErr |
|
@ -84,6 +84,15 @@ func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWrite |
|
|
contentType = "" |
|
|
contentType = "" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if so.SaveInside { |
|
|
|
|
|
buf := bufPool.Get().(*bytes.Buffer) |
|
|
|
|
|
buf.Reset() |
|
|
|
|
|
buf.ReadFrom(part1) |
|
|
|
|
|
filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, nil, nil, 0, buf.Bytes()) |
|
|
|
|
|
bufPool.Put(buf) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadReaderToChunks(w, r, part1, chunkSize, fileName, contentType, contentLength, so) |
|
|
fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadReaderToChunks(w, r, part1, chunkSize, fileName, contentType, contentLength, so) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, nil, err |
|
|
return nil, nil, err |
|
|