mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:11:49 +00:00
gitserver: grpc: relax BlameAuthor name field to allow arbitrary byte sequences (#62917)
This commit is contained in:
parent
22832dcb0c
commit
d1f7715dda
@ -278,7 +278,7 @@ func HunkFromBlameProto(h *proto.BlameHunk) *Hunk {
|
||||
Message: h.GetMessage(),
|
||||
Filename: h.GetFilename(),
|
||||
Author: Signature{
|
||||
Name: h.GetAuthor().GetName(),
|
||||
Name: string(h.GetAuthor().GetName()), // Note: This is not necessarily a valid UTF-8 string, as git does not enforce this.
|
||||
Email: h.GetAuthor().GetEmail(),
|
||||
Date: h.GetAuthor().GetDate().AsTime(),
|
||||
},
|
||||
@ -307,7 +307,7 @@ func (h *Hunk) ToProto() *proto.BlameHunk {
|
||||
Message: h.Message,
|
||||
Filename: h.Filename,
|
||||
Author: &proto.BlameAuthor{
|
||||
Name: h.Author.Name,
|
||||
Name: []byte(h.Author.Name), // We can't guarantee this is valid UTF-8. So, we have to use []byte.
|
||||
Email: h.Author.Email,
|
||||
Date: timestamppb.New(h.Author.Date),
|
||||
},
|
||||
|
||||
8
internal/gitserver/v1/gitserver.pb.go
generated
8
internal/gitserver/v1/gitserver.pb.go
generated
@ -2741,7 +2741,7 @@ type BlameAuthor struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
|
||||
Date *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"`
|
||||
}
|
||||
@ -2778,11 +2778,11 @@ func (*BlameAuthor) Descriptor() ([]byte, []int) {
|
||||
return file_gitserver_proto_rawDescGZIP(), []int{34}
|
||||
}
|
||||
|
||||
func (x *BlameAuthor) GetName() string {
|
||||
func (x *BlameAuthor) GetName() []byte {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *BlameAuthor) GetEmail() string {
|
||||
@ -8020,7 +8020,7 @@ var file_gitserver_proto_rawDesc = []byte{
|
||||
0x69, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x42, 0x12, 0x0a,
|
||||
0x10, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x22, 0x67, 0x0a, 0x0b, 0x42, 0x6c, 0x61, 0x6d, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x64, 0x61,
|
||||
0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
|
||||
@ -679,7 +679,7 @@ message BlameHunk {
|
||||
}
|
||||
|
||||
message BlameAuthor {
|
||||
string name = 1;
|
||||
bytes name = 1;
|
||||
string email = 2;
|
||||
google.protobuf.Timestamp date = 3;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user