fix api meta proto path

pull/905/head
longXboy 4 years ago
parent 0e0be64cba
commit 86193a2a5f
  1. 8
      internal/api/metadata/service.go

@ -6,6 +6,7 @@ import (
"context"
"fmt"
"io/ioutil"
"strings"
"sync"
"github.com/golang/protobuf/proto"
@ -111,6 +112,13 @@ func (s *Service) listServices() (map[string]*descriptorpb.FileDescriptorSet, er
func fileDescriptorProto(path string) (*dpb.FileDescriptorProto, error) {
fdenc := proto.FileDescriptor(path)
// fix proto path
if len(fdenc) == 0 {
idx := strings.LastIndex(path, "/")
if idx > 0 && idx+1 < len(path) {
fdenc = proto.FileDescriptor(path[idx+1:])
}
}
fdDep, err := decodeFileDesc(fdenc)
if err != nil {
return nil, err

Loading…
Cancel
Save