From 829b433d0fc8252a9d8ad22803a1dbdafd90260f Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:11:03 -0400 Subject: [PATCH 1/4] logical/list: return parseErr if any --- api/logical.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/logical.go b/api/logical.go index 977a41ae33d5..de301dfbb874 100644 --- a/api/logical.go +++ b/api/logical.go @@ -115,7 +115,7 @@ func (c *Logical) List(path string) (*Secret, error) { case io.EOF: return nil, nil default: - return nil, err + return nil, parseErr } if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) { return secret, nil From dc6e739b657c658715bcaa77392dcf5b0cb31623 Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:22:40 -0400 Subject: [PATCH 2/4] changelog --- changelog/12338.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/12338.txt diff --git a/changelog/12338.txt b/changelog/12338.txt new file mode 100644 index 000000000000..d0880a82d201 --- /dev/null +++ b/changelog/12338.txt @@ -0,0 +1,3 @@ +```release-note: bug +api/list: Fixes list storage API returning incorrect error when parsing responses +``` From 54a0b5a788032bb10ff82863bea94bc36f8e4315 Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:25:15 -0400 Subject: [PATCH 3/4] Add parseErr to other API endpoints --- api/logical.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/logical.go b/api/logical.go index de301dfbb874..cd950a2b7896 100644 --- a/api/logical.go +++ b/api/logical.go @@ -81,7 +81,7 @@ func (c *Logical) ReadWithData(path string, data map[string][]string) (*Secret, case io.EOF: return nil, nil default: - return nil, err + return nil, parseErr } if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) { return secret, nil @@ -159,7 +159,7 @@ func (c *Logical) write(path string, request *Request) (*Secret, error) { case io.EOF: return nil, nil default: - return nil, err + return nil, parseErr } if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) { return secret, err @@ -206,7 +206,7 @@ func (c *Logical) DeleteWithData(path string, data map[string][]string) (*Secret case io.EOF: return nil, nil default: - return nil, err + return nil, parseErr } if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) { return secret, err @@ -259,7 +259,7 @@ func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) { case io.EOF: return nil, nil default: - return nil, err + return nil, parseErr } if secret != nil && (len(secret.Warnings) > 0 || len(secret.Data) > 0) { return secret, nil From 8feb85db270d6b4a69e53cf7f2da8a5fcaed5e6c Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:27:29 -0400 Subject: [PATCH 4/4] Update 12338.txt --- changelog/12338.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/12338.txt b/changelog/12338.txt index d0880a82d201..6faf03eb5261 100644 --- a/changelog/12338.txt +++ b/changelog/12338.txt @@ -1,3 +1,3 @@ ```release-note: bug -api/list: Fixes list storage API returning incorrect error when parsing responses +api: Fixes storage APIs returning incorrect error when parsing responses ```