Repository navigation
fix(web): keep file and blob metadata in server function uploads - #4617
Conversation
A multipart part always arrives as a file, with `application/octet-stream` for an empty type, a `lastModified` of the time the server parsed it, and `%22` in the name decoded to `"`. The upload node now carries the type, and for a file the name and `lastModified`, and the server rebuilds the value from them over the part's bytes. A node with only the index, from an older client, still reads as the part. Ports solidjs/solid-start#2370. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: e4afb97 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will improve performance by 16.33%1 warning
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Port of solidjs/solid-start#2370. The upload code from #4208 has the same bug.
A multipart part always arrives on the server as a
File. WithenableRichArguments(), a blob comes back as aFilenamedblob, an empty type becomesapplication/octet-stream,lastModifiedis the time the server parsed the request, and%22in a name is decoded to".The upload node now carries the type, plus the name and
lastModifiedfor a file. The server rebuilds aBloborFilefrom those fields over the part's bytes, without copying them. A node with only the index, sent by a tab opened before a deploy, still reads as the raw part.packages/web/server-functions/src/uploads.ts: write and read the metadata fieldspackages/web/test/server/server-functions-uploads.spec.tsx: the blob test now expects aBlobwith its type (including an empty one) instead of aFilenamedblob. New tests cover the exact name andlastModified, and an index-only node from an older client.@solidjs/webA single File or Blob argument still goes as a native body, not through the upload codec, so this change does not touch it.
Checked locally: the three
@solidjs/webvitest suites (1647, 1934 and 754 tests),test-types, and prettier. The 3 new tests fail without the fix.🤖 Generated with Claude Code