@@ -87,7 +87,12 @@ func (p Pass) Add(creds *credentials.Credentials) error {
87
87
88
88
encoded := base64 .URLEncoding .EncodeToString ([]byte (creds .ServerURL ))
89
89
90
- _ , err := p .runPass (creds .Secret , "insert" , "-f" , "-m" , path .Join (PASS_FOLDER , encoded , creds .Username ))
90
+ username := creds .Username
91
+ if strings .Contains (username , "/" ) {
92
+ username = base64 .URLEncoding .EncodeToString ([]byte (creds .Username ))
93
+ }
94
+
95
+ _ , err := p .runPass (creds .Secret , "insert" , "-f" , "-m" , path .Join (PASS_FOLDER , encoded , username ))
91
96
return err
92
97
}
93
98
@@ -160,8 +165,13 @@ func (p Pass) Get(serverURL string) (string, string, error) {
160
165
}
161
166
162
167
actual := strings .TrimSuffix (usernames [0 ].Name (), ".gpg" )
168
+ username := actual
169
+ decodedUsername , err := base64 .URLEncoding .DecodeString (actual )
170
+ if err == nil {
171
+ username = string (decodedUsername )
172
+ }
163
173
secret , err := p .runPass ("" , "show" , path .Join (PASS_FOLDER , encoded , actual ))
164
- return actual , secret , err
174
+ return username , secret , err
165
175
}
166
176
167
177
// List returns the stored URLs and corresponding usernames for a given credentials label
@@ -193,6 +203,10 @@ func (p Pass) List() (map[string]string, error) {
193
203
}
194
204
195
205
resp [string (serverURL )] = strings .TrimSuffix (usernames [0 ].Name (), ".gpg" )
206
+ decodedUsername , err := base64 .URLEncoding .DecodeString (strings .TrimSuffix (usernames [0 ].Name (), ".gpg" ))
207
+ if err == nil {
208
+ resp [string (serverURL )] = string (decodedUsername )
209
+ }
196
210
}
197
211
198
212
return resp , nil
0 commit comments