Skip to content

Commit fdbbeac

Browse files
authored
Merge pull request #612 from andyzhangx/remove-space-parsing-secret
fix: remove special chars when parsing account name from secret
2 parents 093390a + a6875ac commit fdbbeac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/blob/blob.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
413413
}
414414
} else {
415415
for k, v := range secrets {
416+
v = strings.TrimSpace(v)
416417
switch strings.ToLower(k) {
417418
case accountNameField:
418419
accountName = v
@@ -555,6 +556,7 @@ func getStorageAccount(secrets map[string]string) (string, string, error) {
555556

556557
var accountName, accountKey string
557558
for k, v := range secrets {
559+
v = strings.TrimSpace(v)
558560
switch strings.ToLower(k) {
559561
case accountNameField:
560562
accountName = v
@@ -642,7 +644,9 @@ func (d *Driver) GetStorageAccountFromSecret(secretName, secretNamespace string)
642644
return "", "", fmt.Errorf("could not get secret(%v): %w", secretName, err)
643645
}
644646

645-
return string(secret.Data[defaultSecretAccountName][:]), string(secret.Data[defaultSecretAccountKey][:]), nil
647+
accountName := strings.TrimSpace(string(secret.Data[defaultSecretAccountName][:]))
648+
accountKey := strings.TrimSpace(string(secret.Data[defaultSecretAccountKey][:]))
649+
return accountName, accountKey, nil
646650
}
647651

648652
// getSubnetResourceID get default subnet resource ID from cloud provider config

0 commit comments

Comments
 (0)