Skip to content

Commit ce10f3f

Browse files
fix(sdk): Fix handling of kas rewrap errors (#1696)
reversed handling of requests successful error detection in xtest https://github.com/opentdf/tests/actions/runs/11635869428/job/32406122022?pr=220
1 parent cb63819 commit ce10f3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sdk/tdf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,10 @@ func (r *Reader) doPayloadKeyUnwrap(ctx context.Context) error { //nolint:gocogn
806806
wrappedKey, err = client.unwrap(ctx, keyAccessObj, r.manifest.EncryptionInformation.Policy)
807807
if err != nil {
808808
errToReturn := fmt.Errorf("doPayloadKeyUnwrap splitKey.rewrap failed: %w", err)
809-
if !strings.Contains(err.Error(), codes.InvalidArgument.String()) {
809+
if strings.Contains(err.Error(), codes.InvalidArgument.String()) {
810810
return fmt.Errorf("%w: %w", ErrRewrapBadRequest, errToReturn)
811811
}
812-
if !strings.Contains(err.Error(), codes.PermissionDenied.String()) {
812+
if strings.Contains(err.Error(), codes.PermissionDenied.String()) {
813813
return fmt.Errorf("%w: %w", errRewrapForbidden, errToReturn)
814814
}
815815
return errToReturn

0 commit comments

Comments
 (0)