Update aws-sdk-go/service/dynamodb/dynamodbattribute (#4744)

Fixes #4721, Fixes #4742
This commit is contained in:
Jim Kalafut 2018-06-12 06:07:15 -07:00 committed by GitHub
parent 90fe579561
commit d3604289be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package dynamodbattribute package dynamodbattribute
import ( import (
"encoding/base64"
"fmt" "fmt"
"reflect" "reflect"
"strconv" "strconv"
@ -538,6 +539,16 @@ func (d *Decoder) decodeString(s *string, v reflect.Value, fieldTag tag) error {
switch v.Kind() { switch v.Kind() {
case reflect.String: case reflect.String:
v.SetString(*s) v.SetString(*s)
case reflect.Slice:
// To maintain backwards compatibility with the ConvertFrom family of methods
// which converted []byte into base64-encoded strings if the input was typed
if v.Type() == byteSliceType {
decoded, err := base64.StdEncoding.DecodeString(*s)
if err != nil {
return &UnmarshalError{Err: err, Value: "string", Type: v.Type()}
}
v.SetBytes(decoded)
}
case reflect.Interface: case reflect.Interface:
// Ensure type aliasing is handled properly // Ensure type aliasing is handled properly
v.Set(reflect.ValueOf(*s).Convert(v.Type())) v.Set(reflect.ValueOf(*s).Convert(v.Type()))

View File

@ -81,7 +81,7 @@
// The ConvertTo, ConvertToList, ConvertToMap, ConvertFrom, ConvertFromMap // The ConvertTo, ConvertToList, ConvertToMap, ConvertFrom, ConvertFromMap
// and ConvertFromList methods have been deprecated. The Marshal and Unmarshal // and ConvertFromList methods have been deprecated. The Marshal and Unmarshal
// functions should be used instead. The ConvertTo|From marshallers do not // functions should be used instead. The ConvertTo|From marshallers do not
// support BinarySet, NumberSet, nor StringSets, and will incorrect marshal // support BinarySet, NumberSet, nor StringSets, and will incorrectly marshal
// binary data fields in structs as base64 strings. // binary data fields in structs as base64 strings.
// //
// The Marshal and Unmarshal functions correct this behavior, and removes // The Marshal and Unmarshal functions correct this behavior, and removes
@ -91,5 +91,11 @@
// replaced with have been replaced with dynamodbattribute.Marshaler and // replaced with have been replaced with dynamodbattribute.Marshaler and
// dynamodbattribute.Unmarshaler interfaces. // dynamodbattribute.Unmarshaler interfaces.
// //
// The Unmarshal functions are backwards compatible with data marshalled by
// ConvertTo*, but the reverse is not true: objects marshalled using Marshal
// are not necessarily usable by ConvertFrom*. This backward compatibility is
// intended to assist with incremental upgrading of data following a switch
// away from the Convert* family of functions.
//
// `time.Time` is marshaled as RFC3339 format. // `time.Time` is marshaled as RFC3339 format.
package dynamodbattribute package dynamodbattribute

6
vendor/vendor.json vendored
View File

@ -445,10 +445,10 @@
"revisionTime": "2018-02-09T23:01:02Z" "revisionTime": "2018-02-09T23:01:02Z"
}, },
{ {
"checksumSHA1": "/I6I2nR59isqKtSpEnTfLRWZ8Mc=", "checksumSHA1": "dweeMPBmsx8OdMN7S8Ad/+dqge8=",
"path": "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute", "path": "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute",
"revision": "fb9d53b0db7e801eb0d4fa021f5860794d845da3", "revision": "44b48b90a2c30b9c22c31940bb3e8d85a00f79fe",
"revisionTime": "2018-02-09T23:01:02Z" "revisionTime": "2018-06-12T01:50:13Z"
}, },
{ {
"checksumSHA1": "6m97gyHt25GPBhd48PdPaAXCT9Y=", "checksumSHA1": "6m97gyHt25GPBhd48PdPaAXCT9Y=",