Skip to content

fix(client): declare file size in upload metadata#647

Merged
camathieu merged 2 commits intomasterfrom
fix/client-declare-file-size
Feb 26, 2026
Merged

fix(client): declare file size in upload metadata#647
camathieu merged 2 commits intomasterfrom
fix/client-declare-file-size

Conversation

@camathieu
Copy link
Member

What

Include file.Size in getParams() so the server receives the declared file size when creating uploads. This is a prerequisite for server-side quota enforcement on in-flight uploads.

Why

The Go client SDK never sent file sizes to the server during upload creation, even when the size was known (regular files via os.Stat). This prevented the server from using declared sizes for quota enforcement.

Changes

  • plik/file.go — Add params.Size = file.Size in getParams()
  • plik/file_test.go — Add 3 tests for getParams(): reader-based (size=0), path-based (size from os.Stat), and metadata propagation

Testing

go vet, go build, and go test ./plik/... all pass.

ca.mathieu and others added 2 commits February 25, 2026 21:57
Include file.Size in getParams() so the server receives the declared
file size when creating uploads. This allows the server to use the
declared size for quota enforcement on in-flight uploads.

Regular files (via AddFileFromPath) have their size set from os.Stat.
Stdin and archive files naturally stay at 0 (size unknown).

Add unit tests for getParams() covering reader-based files, path-based
files, and metadata propagation.
@camathieu camathieu merged commit 7db9afe into master Feb 26, 2026
7 checks passed
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