@@ -139,15 +139,16 @@ func RegisterAndFetchProtos(ctx context.Context, client *github.Client, protoSch
139139 // or in other words, we treat "workflows/" folder as the root folder for all protos in this schema set and strip it from the paths derived from the repository structure.
140140 prefixesToStrip := determineFolderPrefixesToStrip (protoSchemaSet .Folders )
141141
142+ strippedProtdMap := make (map [string ]string )
143+ strippedSubjects := make (map [string ]string )
144+
142145 for path := range protoMap {
143146 strippedPath := stripFolderPrefix (path , prefixesToStrip )
144- protoMap [strippedPath ] = protoMap [path ]
145- subjects [strippedPath ] = subjects [path ]
146- delete (protoMap , path )
147- delete (subjects , path )
147+ strippedProtdMap [strippedPath ] = protoMap [path ]
148+ strippedSubjects [strippedPath ] = subjects [path ]
148149 }
149150
150- registerErr := registerAllWithTopologicalSorting (schemaRegistryURL , protoMap , subjects )
151+ registerErr := registerAllWithTopologicalSorting (schemaRegistryURL , strippedProtdMap , strippedSubjects )
151152 if registerErr != nil {
152153 return errors .Wrapf (registerErr , "failed to register protos from %s" , protoSchemaSet .URI )
153154 }
@@ -174,7 +175,7 @@ func DefaultSubjectNamingStrategy(subjectPrefix string, proto protoFile, protoSc
174175// extractPackageNameWithRegex extracts the package name from a proto source file using regex.
175176// It returns an error if no package name is found.
176177func extractPackageNameWithRegex (protoSrc string ) (string , error ) {
177- matches := regexp .MustCompile (`(?m)^\s*package\s+([a-zA-Z0-9.]+)\s*;` ).FindStringSubmatch (protoSrc )
178+ matches := regexp .MustCompile (`(?m)^\s*package\s+([a-zA-Z0-9._ ]+)\s*;` ).FindStringSubmatch (protoSrc )
178179 if len (matches ) < 2 {
179180 return "" , fmt .Errorf ("no package name found in proto source" )
180181 }
0 commit comments