Comments (4)
Got the answer from ChatGPT 3.5:
I understand the confusion you're facing, but these two statements are not necessarily contradictory when you consider the specific context and use cases of the Tus protocol.
- "The length of the final upload MUST be the sum of the length of all partial uploads."
This statement is a general guideline that suggests the total length of the final resource should equal the sum of the lengths of all the partial uploads. In your example, if you have two partial uploads, A and B, with lengths 50 bytes and 25 bytes respectively, the total length of the final resource should indeed be 75 bytes based on this guideline.- "The Server MAY delete partial uploads after concatenation. They MAY however be used multiple times to form a final resource."
This statement provides flexibility to servers. It means that servers are allowed to delete the partial uploads after they have been concatenated into the final resource. However, it also acknowledges that servers might choose to keep these partial uploads for various reasons.
In your example, the server could indeed reuse uploads A and B to create the final resource by concatenating them. Still, it's not required to keep them once the final resource has been assembled. The key point is that while they are retained, the total length of the final resource should still be based on the sum of the lengths of the partial uploads.
So, these statements do not necessarily contradict each other. The first statement sets the expectation for the length of the final resource, and the second statement allows servers some flexibility in managing the partial uploads but does not change the expectation set by the first statement regarding the final resource's length.
Q: So the 2nd statement is about after concatenation, then another upload may reuse those partial uploads?
Yes, that's correct. The second statement is primarily about what the server can do with the partial uploads after they have been concatenated to form the final resource.
After concatenation, the server may choose to retain or delete the individual partial uploads. If it retains them, they may be reused in subsequent uploads to form new final resources. In other words, those partial uploads can potentially be used multiple times to create different final resources. This provides a level of flexibility in how servers handle the storage and reuse of partial uploads, but it doesn't change the fact that the length of the final resource should still be based on the sum of the lengths of all partial uploads that contributed to it.
So, you have the correct understanding: the second statement is about the server's post-concatenation actions and the possibility of reusing partial uploads in future uploads.
For some reason I thought the spec was talking about "the current" final upload. So it is a potential future other final upload.
from tus-resumable-upload-protocol.
As I understand the second statement, the server can reuse uploads multiple times, for example upload A is 50 bytes and upload B is 25 bytes then the server can create a final resource using:
1*A + 2*B = 100 bytes
.
That is correct.
The quoted text from the spec allows two type of using a partial upload multiple times:
- use one partial upload multiple times in the same concatenation
- use one partial upload in one concatenation and then use it again later in another concatenation (e.g. a common header for a few files)
When we wrote this text, we had the second use case in mind, but the description is a bit ambiguous. We should add text to explain both use cases and make it clearer. However, I am not sure what alternative to sum
we can use here. Would you have a suggestion?
from tus-resumable-upload-protocol.
Ok now I see.
My initial instinct was probably right, I felt that there were 2 use cases.
My mistaken assumption was that summing up the parts would require unique elements, but as in the 2nd example the summation could be rewritten as: A + B + B
All in all I don't have a suggestion for an alternative to sum
but I do have a better idea how to interpret the spec.
from tus-resumable-upload-protocol.
Thank you, I added some text to hopefully prevent such confusion in the future.
from tus-resumable-upload-protocol.
Related Issues (20)
- Future definition of the Tus-Resumable header HOT 10
- Spam: Nutt
- Spam: Nutt
- Request: Swagger / OpenAPI documentation of the API HOT 8
- Byte-range support for iOS compatibility HOT 2
- > net::ERR_UPLOAD_FILE_CHANGED HOT 2
- Body is not specified in OpenAPI HOT 1
- MIME-type Extension HOT 4
- Unable to resume uploads, Upload-Offset is always 0 HOT 1
- support http/3 HOT 1
- OWASP Considerations HOT 4
- > net::ERR_UPLOAD_FILE_CHANGED HOT 1
- Protocol version confusion HOT 2
- Upload Post-Processing HOT 13
- Which StatusCode of response must server return, if server want to indicate a success HEAD request HOT 5
- How Can I learn about Tus V2? HOT 3
- Add extension to allow for discovery of existing upload URL HOT 4
- Upload-Metadata could be Structured Field Values (RFC 8941) HOT 3
- Support zero length uploads HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tus-resumable-upload-protocol.