Skip to content

Route zero-length files to single-shot upload - #264

Open
lpusok wants to merge 1 commit into
masterfrom
fix-zero-length-multipart
Open

Route zero-length files to single-shot upload#264
lpusok wants to merge 1 commit into
masterfrom
fix-zero-length-multipart

Conversation

@lpusok

@lpusok lpusok commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

A zero-byte file fails in multipart upload mode with:

part_urls count (1) does not match expected (0) for file size 0 and part size ...

ceil(0 / partSize) is 0 expected parts, but the backend (correctly) hands back 1 part URL, so the part-count check rejects it. Non-empty files are unaffected (even 1 byte ceils to 1 part).

Fix

Route empty files through the single-shot path — which already handles empty bodies (nil request body, Content-Length: 0) — even when multipart upload is enabled. A zero-byte file has no valid multipart part layout, so single-shot is the correct mechanism.

Test plan

  • go build ./... passes.
  • Reproduced against a local fake artifact server: a zero-length file failed before the change and uploads successfully after (routed to single-shot).

🤖 Generated with Claude Code

A zero-byte file has no valid multipart layout: ceil(0/partSize) is 0 parts,
but the backend still issues one part URL, so the part-count check rejected
it ("part_urls count (1) does not match expected (0)"). Send empty files
through the single-shot path (which already handles empty bodies) even when
multipart upload is enabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants