remove redundant check and clarify code comment

This commit is contained in:
catsby 2019-12-11 10:16:09 -06:00
parent 3b4313095b
commit e523f1feec
No known key found for this signature in database
GPG Key ID: B7C8F9C70EC5CD29

View File

@ -44,13 +44,11 @@ func (b *backend) pathRestoreUpdate(ctx context.Context, req *logical.Request, d
return logical.ErrorResponse("'backup' must be supplied"), nil
}
// If a name is given, make sure it does not contain any slashes. The Transit
// secret engine does not allow sub-paths in key names
keyName := d.Get("name").(string)
// if a name is given, make sure it does not contain any slashes and look like
// a path
if keyName != "" {
if strings.Contains(keyName, "/") {
return nil, ErrInvalidKeyName
}
if strings.Contains(keyName, "/") {
return nil, ErrInvalidKeyName
}
return nil, b.lm.RestorePolicy(ctx, req.Storage, keyName, backupB64, force)