File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -104,12 +104,12 @@ func GetLastUsedRole() (Role, error) {
104
104
return Role {}, err
105
105
}
106
106
parts := strings .Split (string (contents ), "_" )
107
- if len (parts ) != 3 {
107
+ if len (parts ) < 3 {
108
108
return Role {}, fmt .Errorf ("invalid last used role" )
109
109
}
110
110
region := parts [0 ]
111
111
accountId := parts [1 ]
112
- roleName := parts [2 ]
112
+ roleName := strings . Join ( parts [2 :], "_" )
113
113
role := Role {
114
114
Region : region ,
115
115
AccountId : accountId ,
@@ -139,12 +139,12 @@ func GetSavedRolesWithCredentials() (Roles, error) {
139
139
if ! file .IsDir () && filepath .Ext (filename ) == ".json" {
140
140
contents , err := os .ReadFile (filepath .Join (cacheDir , filename ))
141
141
parts := strings .Split (filename , "_" )
142
- if len (parts ) != 3 {
142
+ if len (parts ) < 3 {
143
143
continue
144
144
}
145
145
region := parts [0 ]
146
146
accountId := parts [1 ]
147
- roleName := strings .TrimSuffix (parts [2 ] , ".json" )
147
+ roleName := strings .TrimSuffix (strings . Join ( parts [2 :], "_" ) , ".json" )
148
148
if err != nil {
149
149
return nil , err
150
150
}
You can’t perform that action at this time.
0 commit comments