// Update the object with the contents of the io.Reader, modTime and size
//
// If existing is set then it updates the object rather than creating a new one
//
// The new object may have been created if an error is returned
Update the object with the contents of the io.Reader, modTime and size

If existing is set then it updates the object rather than creating a new one

The new object may have been created if an error is returned
// Update the object with the contents of the io . Reader modTime and size // // If existing is set then it updates the object rather than creating a new one // // The new object may have been created if an error is returned
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
	err = o.fs.mkParentDir(o.filePath())
	if err != nil {
		return errors.Wrap(err, "Update mkParentDir failed")
	}
	size := src.Size()
	var resp *http.Response
	opts := rest.Opts{
		Method:        "PUT",
		Path:          o.filePath(),
		Body:          in,
		NoResponse:    true,
		ContentLength: &size, 
	}
	if o.fs.useOCMtime {
		opts.ExtraHeaders = map[string]string{
			"X-OC-Mtime": fmt.Sprintf("%f", float64(src.ModTime().UnixNano())/1E9),
		}
	}
	err = o.fs.pacer.CallNoRetry(func() (bool, error) {
		resp, err = o.fs.srv.Call(&opts)
		return shouldRetry(resp, err)
	})
	if err != nil {
		_ = o.Remove()
		return err
	}
	o.hasMetaData = false
	return o.readMetaData()
}
func ( o * Object ) Update ( in io . Reader , src fs . ObjectInfo , options ... fs . OpenOption ) ( err error ) { err = o . fs . mkParentDir ( o . filePath ( ) ) if err != nil { return errors . Wrap ( err , " " ) } size := src . Size ( ) var resp * http . Response opts := rest . Opts { Method : " " , Path : o . filePath ( ) , Body : in , NoResponse : true , ContentLength : & size , } if o . fs . useOCMtime { opts . ExtraHeaders = map [ string ] string { " " : fmt . Sprintf ( " " , float64 ( src . ModTime ( ) . UnixNano ( ) ) / 1E9 ) , } } err = o . fs . pacer . CallNoRetry ( func ( ) ( bool , error ) { resp , err = o . fs . srv . Call ( & opts ) return shouldRetry ( resp , err ) } ) if err != nil { _ = o . Remove ( ) return err } o . hasMetaData = false return o . readMetaData ( ) }
Update the object with the contents of the io.Reader, modTime and size
Update the object with the contents of the io . Reader modTime and size
// FIXME this isn't necessary with owncloud - See https://github.com/nextcloud/nextcloud-snap/issues/365 // Remove failed upload // read metadata from remote