Skip to content

fix(client): upload a bare Blob under the item name - #73

Open
helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/blob-upload-filename
Open

helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/blob-upload-filename

Conversation

@helenkwok

Copy link
Copy Markdown

Closes #71.

  • createFile wraps a bare Blob in a File named after the item (new File([blob], name, { type: blob.type })), so the multipart upload carries the name and the platform sets fileExtension from it. A File keeps its own name.
  • updateFile does the same when name is given; without a name the upload is unchanged.
  • Components and apps (createComponent, createApp, versions) are untouched, since their uploads are bundles.
  • files.ts example: a comment on the Blob upload; patch changeset.

Tests: three cases in client.test.ts ("upload filename"): a bare Blob goes up as result.json with its content intact, a File keeps model.ifc, and updateFile names a Blob. The two Blob cases fail on main (expected 'blob' to be 'result.json'). yarn lint, tsc --noEmit and vitest run pass (154 tests). I didn't run the files.ts example against the live API.

The platform takes fileExtension from the multipart filename. A Blob passed to
createFile or updateFile was appended without one, so it went up as "blob"
and the item was stored with fileExtension "", which Automation extension
conditions never match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createFile / updateFile with a bare Blob store the item with fileExtension "", so Automation extension conditions never fire

1 participant