Skip to content

Commit e1b54c3

Browse files
author
Damian Peckett
committed
[METAL-2804] Make more tolerant of malformed names
1 parent 8a1096a commit e1b54c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mock/database.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,13 @@ func (dp *DatabaseProxy) AddInstance(project, instance string) error {
215215
return err
216216
}
217217

218-
database := strings.Split(instance, "~")[1]
218+
database := instance
219+
220+
databaseNameComponents := strings.Split(instance, "~")
221+
if len(databaseNameComponents) > 1 {
222+
database = databaseNameComponents[1]
223+
}
224+
219225
projectName := fmt.Sprintf("%s:%s", project, database)
220226

221227
serverCertPEM, err := dp.authority.Sign(pubKeyPEM, pkix.Name{

0 commit comments

Comments
 (0)