Skip to content

Commit

Permalink
Use Bytes from convert.go to unmarshal byte value (#2603)
Browse files Browse the repository at this point in the history
  • Loading branch information
HubertZhang committed Mar 26, 2022
1 parent 1d4512b commit 801b88e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions runtime/query.go
@@ -1,7 +1,6 @@
package runtime

import (
"encoding/base64"
"errors"
"fmt"
"net/url"
Expand Down Expand Up @@ -234,7 +233,7 @@ func parseField(fieldDescriptor protoreflect.FieldDescriptor, value string) (pro
case protoreflect.StringKind:
return protoreflect.ValueOfString(value), nil
case protoreflect.BytesKind:
v, err := base64.URLEncoding.DecodeString(value)
v, err := Bytes(value)
if err != nil {
return protoreflect.Value{}, err
}
Expand Down Expand Up @@ -312,7 +311,7 @@ func parseMessage(msgDescriptor protoreflect.MessageDescriptor, value string) (p
case "google.protobuf.StringValue":
msg = &wrapperspb.StringValue{Value: value}
case "google.protobuf.BytesValue":
v, err := base64.URLEncoding.DecodeString(value)
v, err := Bytes(value)
if err != nil {
return protoreflect.Value{}, err
}
Expand Down

0 comments on commit 801b88e

Please sign in to comment.