Skip to content

Commit 116a43d

Browse files
committed
Fixed bug where permission sets with '_' char in them were not showing up
1 parent 8328b5f commit 116a43d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sdk/credentials/role-credentials.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ func GetLastUsedRole() (Role, error) {
104104
return Role{}, err
105105
}
106106
parts := strings.Split(string(contents), "_")
107-
if len(parts) != 3 {
107+
if len(parts) < 3 {
108108
return Role{}, fmt.Errorf("invalid last used role")
109109
}
110110
region := parts[0]
111111
accountId := parts[1]
112-
roleName := parts[2]
112+
roleName := strings.Join(parts[2:], "_")
113113
role := Role{
114114
Region: region,
115115
AccountId: accountId,
@@ -139,12 +139,12 @@ func GetSavedRolesWithCredentials() (Roles, error) {
139139
if !file.IsDir() && filepath.Ext(filename) == ".json" {
140140
contents, err := os.ReadFile(filepath.Join(cacheDir, filename))
141141
parts := strings.Split(filename, "_")
142-
if len(parts) != 3 {
142+
if len(parts) < 3 {
143143
continue
144144
}
145145
region := parts[0]
146146
accountId := parts[1]
147-
roleName := strings.TrimSuffix(parts[2], ".json")
147+
roleName := strings.TrimSuffix(strings.Join(parts[2:], "_"), ".json")
148148
if err != nil {
149149
return nil, err
150150
}

0 commit comments

Comments
 (0)