Skip to content

fix(safeoutputs): send Content-Range header for pipeline artifact uploads#467

Merged
jamesadevine merged 2 commits into
mainfrom
copilot/fix-upload-pipeline-artifact-http-error
May 8, 2026
Merged

fix(safeoutputs): send Content-Range header for pipeline artifact uploads#467
jamesadevine merged 2 commits into
mainfrom
copilot/fix-upload-pipeline-artifact-http-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

The Azure DevOps File Container API rejects every upload-pipeline-artifact PUT with HTTP 400: Content-Range header not understood. because the header is required on all uploads — including single-chunk ones — and ado-aw wasn't sending it.

Summary

  • Set Content-Range: bytes 0-{N-1}/{N} on the container PUT in src/safeoutputs/upload_pipeline_artifact.rs (and bytes */0 for zero-byte files, matching the form ADO's own clients send).
  • Extracted the formatting into a format_content_range(file_size) helper to keep the upload site readable and unit-testable.
let content_range = format_content_range(file_size); // "bytes 0-11/12", or "bytes */0" if empty

client.put(&upload_url)
    .header("Content-Type", "application/octet-stream")
    .header("Content-Range", &content_range)
    .basic_auth("", Some(token))
    .body(file_bytes)
    .send().await?;

Test plan

  • New unit test test_format_content_range covers 0, 1, 12, and 1024-byte payloads.
  • cargo test --bin ado-aw upload_pipeline_artifact — all 26 tests pass.

Copilot AI changed the title [WIP] Fix upload-pipeline-artifact safe output HTTP 400 error fix(safeoutputs): send Content-Range header for pipeline artifact uploads May 8, 2026
Copilot AI requested a review from jamesadevine May 8, 2026 14:53
@jamesadevine jamesadevine marked this pull request as ready for review May 8, 2026 15:07
@jamesadevine jamesadevine merged commit e95cbf5 into main May 8, 2026
@jamesadevine jamesadevine deleted the copilot/fix-upload-pipeline-artifact-http-error branch May 8, 2026 15:07
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.

upload-pipeline-artifact safe output fails with HTTP 400: Content-Range header not understood

2 participants