diff options
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/command/filer_copy.go | 2 | ||||
| -rw-r--r-- | weed/operation/upload_content.go | 3 | ||||
| -rw-r--r-- | weed/topology/store_replicate.go | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 9afa65d23..322e5418d 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -122,7 +122,7 @@ func runCopy(cmd *Command, args []string) bool { expectedBucket := restPath[:strings.Index(restPath, "/")] if *copy.collection == "" { *copy.collection = expectedBucket - } else { + } else if *copy.collection != expectedBucket { fmt.Printf("destination %s uses collection \"%s\": unexpected collection \"%v\"\n", urlPath, expectedBucket, *copy.collection) return true } diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index ac0b477cb..fccc24b16 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -169,7 +169,7 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i uploadResult, err = upload_content(uploadUrl, func(w io.Writer) (err error) { _, err = w.Write(data) return - }, filename, contentIsGzipped, 0, mtype, pairMap, jwt) + }, filename, contentIsGzipped, len(data), mtype, pairMap, jwt) } if uploadResult == nil { @@ -190,6 +190,7 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error body_writer := multipart.NewWriter(buf) h := make(textproto.MIMEHeader) h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileNameEscaper.Replace(filename))) + h.Set("Idempotency-Key", uploadUrl) if mtype == "" { mtype = mime.TypeByExtension(strings.ToLower(filepath.Ext(filename))) } diff --git a/weed/topology/store_replicate.go b/weed/topology/store_replicate.go index faa16e2f6..6b4076913 100644 --- a/weed/topology/store_replicate.go +++ b/weed/topology/store_replicate.go @@ -81,6 +81,7 @@ func ReplicatedWrite(masterNode string, s *storage.Store, volumeId needle.Volume } // volume server do not know about encryption + // TODO optimize here to compress data only once _, err := operation.UploadData(u.String(), string(n.Name), false, n.Data, n.IsCompressed(), string(n.Mime), pairMap, jwt) return err }); err != nil { |
