fix: file upload content length - #301
Merged
armando-rodriguez-cko merged 4 commits intoFeb 20, 2026
Merged
Conversation
- Set explicit stream size in ApiClient::submit() so Guzzle sends Content-Length instead of Transfer-Encoding: chunked (rejected by API) - Add filename to multipart file part for proper Content-Disposition - Add security note in FileRequest/uploadFile: path must be app-controlled - Add ApiClientTest for Content-Length header and body size consistency - Compatible with PHP 7.1–8.4 and PHPUnit 5.7 / 9
- Use PlatformType::$default (previous deprecated) - Add uploadFileSendsContentLengthHeader() for INT-1597 - Set purpose in shouldUploadFile; add INT-1597 doc to integration test
|
david-ruiz-cko
approved these changes
Feb 20, 2026
armando-rodriguez-cko
deleted the
bugfix/INT-1597-file-upload-content-length
branch
February 20, 2026 09:14
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.



This pull request improves the reliability and security of file uploads in the SDK, particularly ensuring that file uploads include the correct
Content-Lengthheader to meet API requirements. It also clarifies documentation and type annotations regarding file path handling, and adds robust automated tests to verify correct upload behavior.File upload reliability and API compatibility:
ApiClientto use a Guzzle stream with an explicit size, ensuring that theContent-Lengthheader is set for multipart uploads. This prevents failures with APIs that reject chunked uploads without a content length.ApiClientTest,DisputesClientTest, and integration tests) to verify that file uploads send the correctContent-Lengthheader and that its value matches the actual body size. [1] [2] [3]Security and documentation improvements:
FileRequest.php,FilesClient.php, and the README to emphasize that file paths must be application-controlled and not taken directly from untrusted user input. [1] [2] [3]Test and configuration updates: