Fix multi-value attribute encoding for non-ASCII characters#96
Fix multi-value attribute encoding for non-ASCII characters#96TharmiganK merged 8 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
=======================================
Coverage 96.66% 96.66%
=======================================
Files 2 2
Lines 30 30
Branches 10 10
=======================================
Hits 29 29
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
193cf99 to
f1cb7da
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where multi-value LDAP attributes containing non-ASCII characters only returned the first value. The root cause was the processAttribute method using attribute.getValueByteArray() (singular) which only returns the first value's byte array, when it should have been using getValueByteArrays() (plural) to get all values.
Changes:
- Refactored
processAttributemethod to usegetValueByteArrays()and handle multiple encoded values correctly - Added new
encodeAttributeValueshelper method for batch encoding - Updated
encodeAttributeValuesignature to accept attribute name and byte array separately - Added test case with Japanese, Greek, and Chinese characters in multi-value description field
- Version bumped to 1.3.1
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| native/src/main/java/io/ballerina/lib/ldap/Client.java | Fixed processAttribute to handle multi-value attributes with base64 encoding; added encodeAttributeValues helper method; refactored encodeAttributeValue signature |
| ballerina/tests/test.bal | Added testMultiValueAttributeWithNonAscii test case to verify the fix |
| changelog.md | Documented the bug fix in unreleased section |
| ballerina/Dependencies.toml | Updated version to 1.3.1 and crypto dependency to 2.9.3 (auto-generated) |
| ballerina/Ballerina.toml | Updated package version to 1.3.1 and native library to 1.3.1-SNAPSHOT |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Nuvindu Nirmana <63797478+Nuvindu@users.noreply.github.com>
Description
When an LDAP attribute has multiple values containing non-ASCII characters, only the first value was returned. The
processAttributemethod was usingattribute.getValueByteArray()(singular) which only returns the first value's byte array, ignoring subsequent values.Fixes ballerina-platform/ballerina-library#8562
One line release note:
Type of change
How Has This Been Tested?
testMultiValueAttributeWithNonAsciitest that creates an entry with multi-valuedescriptionattribute containing Japanese, Greek, and Chinese characters, then verifies all 3 values are returnedTest Configuration:
Checklist:
Security checks