yandex: pass options to rest.Opts for upload

This commit is contained in:
Tim Gallant 2020-03-21 14:56:11 -07:00 committed by Nick Craig-Wood
parent 011ca244b2
commit 51b617f601

View file

@ -1065,7 +1065,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
return resp.Body, err return resp.Body, err
} }
func (o *Object) upload(ctx context.Context, in io.Reader, overwrite bool, mimeType string) (err error) { func (o *Object) upload(ctx context.Context, in io.Reader, overwrite bool, mimeType string, options ...fs.OpenOption) (err error) {
// prepare upload // prepare upload
var resp *http.Response var resp *http.Response
var ur api.AsyncInfo var ur api.AsyncInfo
@ -1073,6 +1073,7 @@ func (o *Object) upload(ctx context.Context, in io.Reader, overwrite bool, mimeT
Method: "GET", Method: "GET",
Path: "/resources/upload", Path: "/resources/upload",
Parameters: url.Values{}, Parameters: url.Values{},
Options: options,
} }
opts.Parameters.Set("path", o.fs.opt.Enc.FromStandardPath(o.filePath())) opts.Parameters.Set("path", o.fs.opt.Enc.FromStandardPath(o.filePath()))
@ -1121,7 +1122,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
} }
//upload file //upload file
err = o.upload(ctx, in1, true, fs.MimeType(ctx, src)) err = o.upload(ctx, in1, true, fs.MimeType(ctx, src), options...)
if err != nil { if err != nil {
return err return err
} }