Skip to content

feat: save download builds through the editor when the artifact url is not http - #121

Draft
kpal81xd wants to merge 1 commit into
mainfrom
feat/build-artifact-transfer
Draft

kpal81xd wants to merge 1 commit into
mainfrom
feat/build-artifact-transfer

Conversation

@kpal81xd

Copy link
Copy Markdown
Collaborator

Summary

download_build saves the archive with fetch(artifact.url) from Node. Some editors return an artifact URL that is only reachable from the editor page, such as the root-relative path /api/projects/1/builds/5/download/My%20Game.zip. Node's fetch can't resolve it, so the download fails.

  • http(s):// artifact URLs keep using fetch exactly as before.
  • Any other URL is read over the editor connection instead, using the same chunked transfer as download_asset.
  • The read-and-save loop from download_asset moves to src/tools/transfer.ts (readTransfer) and is shared by both tools. download_asset behaviour is unchanged: same size limits, base64 validation, temp file plus rename/link, overwrite handling and error messages.
  • Adds test/build-download.test.ts.

Dependency

This needs the editor driver method builds:artifact:start(buildId, maxInlineBytes). It replies with the same contract as files:download:start: either inline { size, filename, mime, base64 } or chunked { transferId, size, chunkSize, filename, mime }, read with files:download:read and closed with files:transfer:finish.

Manual smoke test

  1. Connect to an editor that returns an https:// artifact URL, then run download_build with format: static and a new outputPath. Expected: the archive is saved to outputPath as before, and the result reports buildId, path and bytes.
  2. Connect to an editor that returns a root-relative artifact URL, then run download_build with a new outputPath. Expected: the archive is saved through the editor connection, it matches the build download byte for byte, and no .tmp file is left next to it.
  3. Against the editor from step 2, run download_build again with the same outputPath and no overwrite. Expected: the call fails with "File already exists" and the existing file is unchanged.
  4. Repeat step 3 with overwrite: true. Expected: the file is replaced.

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.

1 participant