Repository navigation
fix(form): base64-decode bytes values on deserialization - #832
Merged
Vincent Biret (baywet) merged 1 commit intoOct 27, 2026
Merged
Conversation
Dennys Kaluzny Pereira (protonnegativo)
requested a review
from a team
as a code owner
October 27, 2026 04:40
Copilot started reviewing on behalf of
Dennys Kaluzny Pereira (protonnegativo)
October 27, 2026 04:41
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fix restores writer-reader symmetry, with regression coverage for the affected behavior and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #831 by making form byte deserialization decode base64, matching the form writer and the JSON fix in #646.
Changes:
- Decode base64 values instead of returning their UTF-8 bytes.
- Correct the existing assertion and add regression tests for round trips, malformed input, and byte collections.
| File | Description |
|---|---|
packages/serialization/form/tests/unit/test_form_parse_node.py |
Verifies decoded bytes and adds regression coverage. |
packages/serialization/form/kiota_serialization_form/form_parse_node.py |
Uses base64.b64decode in the bytes helper. |
Review effort: Balanced
Vincent Biret (baywet)
approved these changes
Oct 27, 2026
Vincent Biret (baywet)
enabled auto-merge
October 27, 2026 12:27
Member
|
Dennys Kaluzny Pereira (@protonnegativo) would you mind signing the CLA (see the bot comment) please? This way we'll be able to merge the PR |
Contributor
Author
|
@microsoft-github-policy-service agree |
FormSerializationWriter.write_bytes_value writes bytes as base64, but FormParseNode.get_bytes_value returned the base64 text encoded as UTF-8 instead of decoding it, so a value written by the writer did not read back as the original bytes. Decode the value with base64.b64decode, as the JSON (microsoft#646) and text parse nodes do.
Vincent Biret (baywet)
force-pushed
the
fix/form-bytes-base64
branch
from
October 27, 2026 18:48
bcc97da to
acbf899
Compare
|
Copilot started reviewing on behalf of
Dennys Kaluzny Pereira (protonnegativo)
October 27, 2026 18:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Overview
FormSerializationWriter.write_bytes_value()writes bytes as base64, butFormParseNode.get_bytes_value()returned the base64 text encoded as UTF-8 instead of decoding it, so a value written by the form writer did not read back as the original bytes. This decodes it withbase64.b64decode, the same change #646 made forJsonParseNode.TextParseNodealready decodes.Related Issue
Fixes #831
Notes
get_bytes_value()returns, as fix(json): base64-decode bytes values on deserialization #646 did for JSON. Code that worked around the bug by callingbase64.b64decode()on the result (the existingtest_get_bytes_valuedid that) would now decode twice.get_collection_of_primitive_values(bytes)uses the same helper, so it now returns decoded values too.Nonethrough the existingexceptin_get_bytes_value. It used to come back as its raw UTF-8 bytes.Testing Instructions
cd packages/serialization/formpip install -r requirements-dev.txtpytest: 121 passed. With only the parse node change reverted,test_get_bytes_value,test_get_bytes_value_round_trip,test_get_bytes_value_invalid_base64andtest_get_collection_of_bytes_valuesfail.yapf -dr kiota_serialization_form,isort kiota_serialization_form,pylint kiota_serialization_form --disable=W --rcfile=.pylintrcandmypy kiota_serialization_formare clean.