summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-openapi/strfmt/default.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-openapi/strfmt/default.go')
-rw-r--r--vendor/github.com/go-openapi/strfmt/default.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/github.com/go-openapi/strfmt/default.go b/vendor/github.com/go-openapi/strfmt/default.go
index fcf10a6a25..a89a4de3f3 100644
--- a/vendor/github.com/go-openapi/strfmt/default.go
+++ b/vendor/github.com/go-openapi/strfmt/default.go
@@ -240,11 +240,14 @@ func (b *Base64) UnmarshalText(data []byte) error { // validation is performed l
func (b *Base64) Scan(raw interface{}) error {
switch v := raw.(type) {
case []byte:
- if err := b.UnmarshalText(v); err != nil {
+ dbuf := make([]byte, base64.StdEncoding.DecodedLen(len(v)))
+ n, err := base64.StdEncoding.Decode(dbuf, v)
+ if err != nil {
return err
}
+ *b = dbuf[:n]
case string:
- vv, err := base64.URLEncoding.DecodeString(v)
+ vv, err := base64.StdEncoding.DecodeString(v)
if err != nil {
return err
}
@@ -262,7 +265,7 @@ func (b Base64) Value() (driver.Value, error) {
}
func (b Base64) String() string {
- return base64.URLEncoding.EncodeToString([]byte(b))
+ return base64.StdEncoding.EncodeToString([]byte(b))
}
// MarshalJSON returns the Base64 as JSON
@@ -276,7 +279,7 @@ func (b *Base64) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &b64str); err != nil {
return err
}
- vb, err := base64.URLEncoding.DecodeString(b64str)
+ vb, err := base64.StdEncoding.DecodeString(b64str)
if err != nil {
return err
}
@@ -297,7 +300,7 @@ func (b *Base64) UnmarshalBSON(data []byte) error {
}
if bd, ok := m["data"].(string); ok {
- vb, err := base64.URLEncoding.DecodeString(bd)
+ vb, err := base64.StdEncoding.DecodeString(bd)
if err != nil {
return err
}