Skip to content

Commit

Permalink
fix(engine): pk uuid (#6801)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault authored Jan 19, 2024
1 parent 6b6fb74 commit 773ec9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engine/gorpmapper/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ func (m *Mapper) getEncryptedSliceData(ctx context.Context, db gorp.SqlExecutor,

// Find the right target against the primary key
primaryKeyReference := reflectFindValueByTag(targetSlice.Interface(), "db", key)

// Check the primary key known the from target slice and from the database
if reflect.DeepEqual(primaryKeyReference, newPk) {
// the pk could be a []uint8. If it's the case, string values are compared
if reflect.DeepEqual(primaryKeyReference, newPk) || primaryKeyReference == fmt.Sprintf("%s", newPk) {
targetSliceFound = true
// Decrypt all the contents
for idx := range mapping.EncryptedFields {
Expand All @@ -327,7 +329,7 @@ func (m *Mapper) getEncryptedSliceData(ctx context.Context, db gorp.SqlExecutor,
}
}
if !targetSliceFound {
return sdk.WithStack(fmt.Errorf("unmatched element with pk %T %v (%v)", newPk, newPk, pks))
return sdk.WithStack(fmt.Errorf("unmatched element with pk type:%T - value:%v - pks:%v", newPk, newPk, pks))
}
}

Expand Down

0 comments on commit 773ec9c

Please sign in to comment.