Skip to content

Commit

Permalink
Merge pull request #19 from hashicorp/empty-key-checks
Browse files Browse the repository at this point in the history
Check empty keys during write
  • Loading branch information
vishalnayak authored Nov 6, 2018
2 parents 25c9e7d + b35b8d5 commit 2236f14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions path_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ func (b *versionedKVBackend) pathDataRead() framework.OperationFunc {
func (b *versionedKVBackend) pathDataWrite() framework.OperationFunc {
return func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
key := data.Get("path").(string)
if key == "" {
return logical.ErrorResponse("missing path"), nil
}

config, err := b.config(ctx, req.Storage)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions path_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func (b *versionedKVBackend) pathMetadataRead() framework.OperationFunc {
func (b *versionedKVBackend) pathMetadataWrite() framework.OperationFunc {
return func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
key := data.Get("path").(string)
if key == "" {
return logical.ErrorResponse("missing path"), nil
}

maxRaw, mOk := data.GetOk("max_versions")
casRaw, cOk := data.GetOk("cas_required")
Expand Down

0 comments on commit 2236f14

Please sign in to comment.