Skip to content

fix: retain metadata when decrypting array entries - #56

Open
Shubham-Padkonde wants to merge 1 commit into
Mastercard:mainfrom
Shubham-Padkonde:fix/array-decryption-metadata
Open

Shubham-Padkonde wants to merge 1 commit into
Mastercard:mainfrom
Shubham-Padkonde:fix/array-decryption-metadata

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Description

Decrypting an array entry fails with TypeError: list indices must be integers or slices, not str when its encrypted object contains additional metadata. After removing encryption fields, cleanup_node falls through to dictionary indexing on the parent list because the object is still nonempty.

Resolve the list parent to its first object before checking whether the encrypted node is empty. This retains additional metadata while preserving cleanup of empty objects.

Validation

  • Added a real encrypt/decrypt regression with additional metadata. It fails with the exception above before the fix and passes afterward.
  • All 219 unit tests pass (python -m unittest discover -q).
  • git diff --check passes.

PR checklist

  • An issue/feature request has been created for this PR (self-contained reproduction above)
  • Title and description explain the change and validation
  • Covered by unit tests

This targets the current default branch, main; the template's master reference appears outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant