-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding corrupts data #94
Labels
bug
Something isn't working
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using
FormDataEncoder
to encode data objects, specifically JPEG image data, the data gets corrupted.To Reproduce
This can easily be reproduced by feeding JPEG image data into
FormDataEncoder
's encode function, then feeding it's output intoFormDataDecoder
's decode function and comparing the input data with the output data.The comparison fails indicating that the original data is not equal to the decoded data.
When inspecting the bytes it shows a ~90% increase in size. @Joannis suggested one can expect such increase with base64 encoding while @vzsg was more specific pointing out that base64's "expanded size" is 4:3 not 3:2.
@vzsg also expressed concern that the encode method returns a String instead of Data as binary files may not be valid UTF-8.
Expected behavior
The decoded data is equal to the original data.
Environment
multipart-kit version: 4.6.0
swift-tools-version: 5.7
macOS version: 14.2.1
The text was updated successfully, but these errors were encountered: