Repository navigation
Conversation
The TUS protocol spec requires the Upload-Checksum header value to be base64-encoded. The TusPhp client (used in acceptance tests) always sends base64. checkHash() was comparing the raw base64 string against hex.EncodeToString(), which never matches, so every upload that sent a checksum received HTTP 460 Checksum Mismatch. Decode from base64 first (using h.Size() to verify the decoded length matches the expected hash); if decoding succeeds, convert to hex before comparing. Plain hex values (from direct API callers) fall through unchanged, so backward compatibility is preserved. Relates to #879 (which re-enabled checksum validation but missed the encoding difference between TUS clients and the internal hex format). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
For multi-chunk TUS uploads each PATCH carries the checksum of that chunk only, not the whole-file checksum. Storing a per-chunk checksum for FinishUpload whole-file validation caused every chunked upload with per-chunk checksums to fail with 460 Checksum Mismatch. Restrict SetChecksum() to single-chunk uploads: offset == 0 and Content-Length equals the declared upload size. For multi-chunk uploads the Upload-Checksum header is silently ignored, preserving the existing behaviour that tusd v2 established when it dropped per-chunk validation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
stable-8.2 passes fs directly as tusd.DataStore instead of the upload.Coordinator abstraction introduced in later branches; add a comment explaining why the type assertion is safe here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
mklos-kw
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #883 to stable-8.2.
Note: on this branch
checkHashlives in two places (pre-coordinator refactor):pkg/storage/utils/decomposedfs/upload/upload.gopkg/ocm/storage/received/upload.goBoth are fixed. See #883 for full details.
🤖 Generated with Claude Code