mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
Merge branch 'master-oss' into cubbyhole-the-world
This commit is contained in:
@@ -99,9 +99,34 @@ func handleLogical(core *vault.Core, dataOnly bool, prepareRequestCallback Prepa
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if (op == logical.ReadOperation || op == logical.ListOperation) && resp == nil {
|
||||
respondError(w, http.StatusNotFound, nil)
|
||||
return
|
||||
switch {
|
||||
case op == logical.ReadOperation:
|
||||
if resp == nil {
|
||||
respondError(w, http.StatusNotFound, nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Basically: if we have empty "keys" or no keys at all, 404. This
|
||||
// provides consistency with GET.
|
||||
case op == logical.ListOperation:
|
||||
if resp == nil || len(resp.Data) == 0 {
|
||||
respondError(w, http.StatusNotFound, nil)
|
||||
return
|
||||
}
|
||||
keysInt, ok := resp.Data["keys"]
|
||||
if !ok || keysInt == nil {
|
||||
respondError(w, http.StatusNotFound, nil)
|
||||
return
|
||||
}
|
||||
keys, ok := keysInt.([]string)
|
||||
if !ok {
|
||||
respondError(w, http.StatusInternalServerError, nil)
|
||||
return
|
||||
}
|
||||
if len(keys) == 0 {
|
||||
respondError(w, http.StatusNotFound, nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Build the proper response
|
||||
|
||||
Reference in New Issue
Block a user