Conversation
Uploads over 5MB switch from MultipartFile.fromPath to fromBytes, and
only fromPath derives a filename when the caller omits one. Every chunk
part therefore went out with no filename in its content-disposition, so
Swoole parsed it as an ordinary form field instead of a file upload,
getFiles('file') came back empty and the server rejected the upload with
storage_file_empty.
Deriving the filename at construction keeps both upload paths sending
the same part. Dart and Flutter share this template, so both are fixed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The InputFile tests only asserted the derived filename field. This uploads a file one byte over the chunk size to a loopback HttpServer and checks every chunk's content-disposition carries the filename, so the regression (chunks sent as plain form fields, rejected as an empty file) fails the suite even if chunkedUpload stops forwarding the field. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The stub now derives completion from the content-range header the client sends instead of reporting a fixed chunksTotal, and the assertion is that every multipart request carried the filename rather than that exactly two did, so a change to ClientIO.chunkSize cannot turn this red on its own. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Uploads over 5 MB from the Flutter and Dart SDKs fail with
storage_file_empty/ "Empty file passed to the endpoint." whenever the caller usesInputFile.fromPath(path: ...)without passingfilename:. Files at or under 5 MB upload fine, which is what makes it look like a chunking problem.It isn't. The SDK chunks correctly. The two upload paths just build the multipart part differently:
content-dispositionsentMultipartFile.fromPath(...)name="file"; filename="video.mp4"MultipartFile.fromBytes(..., filename: file.filename)name="file"InputFile.fromPathleavesfilenamenull when the caller omits it.package:http's IO helper doesfilename ??= segments.last, so the single-request path always ends up with a filename, whilefromBytespasses the null straight through andpackage:httpemits the attribute onlyif (file.filename != null).A multipart part with no filename is not a file upload. Swoole puts it in
$request->post, so$request->getFiles('file')returns[]andCreate.phpthrowsSTORAGE_FILE_EMPTY. Every chunk is rejected.Fix
Derive the filename from the path at construction, the same way
package:httpalready does forMultipartFile.fromPath, so both upload paths send an identical part. Dart and Flutter share this template, so one change covers both SDKs. A path with no final segment (/path/to/) still leavesfilenamenull, so nothing starts sendingfilename="".Verification
Driving the real generated SDK at a Swoole server that reproduces Appwrite's
getFiles('file')check, uploading 12 MB viaInputFile.fromPath(path: ...)with nofilename:Before:
After:
The unit tests were also seen red against the pre-fix template, failing on exactly the null filename:
Generationsuite: 87 passed, 4 skipped.lint-twig: 586 files, 0 errors. Generated Dart SDK passesdart analyzewith no issues.Notes
expect(inputFile.filename, isNull), which pinned the broken behaviour. It is updated rather than removed.InputFile.fromBytesalready requires a filename.filename:explicitly.composer lint(phpcs) reports 219 pre-existing errors across 21 PHP files onmain. This PR changes no PHP and leaves them alone.🤖 Generated with Claude Code