-
Notifications
You must be signed in to change notification settings - Fork 120
feat(upload): Resumable Uploads #6203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jjbayer
wants to merge
45
commits into
master
Choose a base branch
from
feat/tus-offset
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
08b5d5b
wip
jjbayer ce6c726
fix test
jjbayer d235437
test: show parts are compressed
jjbayer 5bf53ea
clean
jjbayer e23db71
wip: disable compression
jjbayer 5024e87
lint
jjbayer 67adbf0
wip: compression
jjbayer a0a080d
compile
jjbayer 16b9503
wip
jjbayer 68439a9
validate offset
jjbayer 4c07979
fix
jjbayer e2f0ee6
Merge branch 'master' into feat/tus-offset
jjbayer 2d57528
Merge remote-tracking branch 'origin/master' into feat/tus-offset
jjbayer 8ee8867
Merge remote-tracking branch 'origin/feat/tus-offset' into feat/tus-o…
jjbayer a713d02
fix
jjbayer c83bc3b
feat(upload): add finish message
jjbayer b75405f
fix(upload): finalize multipart streams
jjbayer 3b95811
clarify
jjbayer cd59426
test
jjbayer 19a5bd4
lint
jjbayer 46f1abe
resolve todo
jjbayer 1adf88d
test
jjbayer dd42199
test
jjbayer 187f733
wip: fix
jjbayer c100fd4
fix: finish
jjbayer edea406
lint
jjbayer c449e5f
fix: finish only multipart
jjbayer 476cf0c
Merge remote-tracking branch 'origin/master' into feat/tus-offset
jjbayer 0bae8de
changelog
jjbayer 3fcff0c
unflake
jjbayer 687d494
review
jjbayer e3b6dd3
fixes
jjbayer c665f6b
Revert "fixes"
jjbayer b97afdc
no finish
jjbayer 71a6eb2
no multipart for Defer-Length-1
jjbayer f4d1089
reject offset > 0
jjbayer 9c60de6
fix
jjbayer ace745a
more fixes
jjbayer 941913c
error handling
jjbayer 84c16db
fix: save trailing data
jjbayer 1aad8f4
fix
jjbayer 533f818
fixes by claude
jjbayer 99615fb
test
jjbayer 57ebe51
cleanup
jjbayer 9bf8390
fix: return an error for unaligned bytes
jjbayer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,13 @@ fn validate(item: &Item, config: &Config) -> Result<(), ProcessingError> { | |
| serde_json::from_slice(&payload).map_err(|_| ProcessingError::InvalidAttachmentRef)?; | ||
| let signed_location: SignedLocation<Final> = SignedLocation::try_from_str(payload.location) | ||
| .ok_or(ProcessingError::InvalidAttachmentRef)?; | ||
|
|
||
| if signed_location.upload_id().is_some() { | ||
| // `SignedLocation<Final>` should never have an upload ID. | ||
| // NOTE: we could encode this into the `Final` type. | ||
| return Err(ProcessingError::InvalidAttachmentRef); | ||
| } | ||
|
Comment on lines
+56
to
+60
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // NOTE: Using the received timestamp here breaks tests without a pop-relay. | ||
| let location = signed_location | ||
| .verify(chrono::Utc::now(), config) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed length below Upload-Length
Medium Severity
When
Upload-Lengthis known, the PATCH handler sets the stream lower bound to0instead of requiring the remaining byte count. A client can send fewer bytes than declared, still receive 204, and the upload service signs aFinallocation whose length is the bytes actually streamed (oneshot) rather than the announced total. That can finalize an upload below the committed length the client advertised at creation.Additional Locations (1)
relay-server/src/services/upload.rs#L436-L441Reviewed by Cursor Bugbot for commit 57ebe51. Configure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is by design: The client is allowed to upload a file in parts. For "oneshot", we deliberately correct the returned upload length down.