Skip to content

Commit 68b3aca

Browse files
authored
Fix parse plugin references for hosts with ports (#3255)
The version suffix should be parsed from the last ':' present in the string to avoid splitting the string on the address of the BSR. For example the value '0.0.0.0:60156/protocolbuffers/go:v1.33.0' is a valid plugin reference.
1 parent 42bf76e commit 68b3aca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

private/bufpkg/bufremoteplugin/bufremotepluginref/bufremotepluginref.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ func newInvalidPluginIdentityStringError(s string) error {
145145
}
146146

147147
func parsePluginReference(reference string, revision int) (PluginReference, error) {
148-
name, version, ok := strings.Cut(reference, ":")
149-
if !ok {
148+
index := strings.LastIndex(reference, ":")
149+
if index == -1 {
150150
return nil, fmt.Errorf("plugin references must be specified as \"<name>:<version>\" strings")
151151
}
152+
name, version := reference[:index], reference[index+1:]
152153
identity, err := PluginIdentityForString(name)
153154
if err != nil {
154155
return nil, err

0 commit comments

Comments
 (0)