-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[oc] Handle OC-Total-Length in new chunking #7533
[oc] Handle OC-Total-Length in new chunking #7533
Conversation
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
d7974ad
to
ec8bf53
Compare
Codecov Report
@@ Coverage Diff @@
## master #7533 +/- ##
============================================
+ Coverage 51.16% 51.17% +<.01%
- Complexity 24866 24871 +5
============================================
Files 1601 1602 +1
Lines 94684 94701 +17
Branches 1368 1368
============================================
+ Hits 48448 48459 +11
- Misses 46236 46242 +6
|
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.
Lets do this!
For me the chunkingPlugin |
@MorrisJobke Strange... Was the file larger than 10MiB (otherwise the chunking is not used)? |
Yes - but I will have another try, could be 10,5 MB and and 10,5 MiB. |
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.
Tested and works 👍
Imported from owncloud/core#28545.
This pull request ensures that the
OC-Total-Length
header provided in the finalMOVE
operation of a chunked upload matches the length of the chunks in the server, aborting the upload if they do not match; it is similar to the check performed for each chunk, but for the whole file instead. Obviously this is not an integrity check, but something to quickly reject an upload if some chunks are missing.Differences with the original pull request:
composer dump-autoload
when the ChunkingPlugin.php file was added.sanitizeMTime
was different in current master than in master of the original pull request, so when moving it to Node.php the same version as in current master was usedbaseUrlWithoutOCSAppendix
does not exist in Nextcloud, so it was replaced by its implementationIt can be tested by modifying the uploader code of the Web UI to send less bytes than expected (for example, by adding
options.blob = options.blob.slice(0, options.blob.size - 1);
to the beginning of_initXHRData
.Finally, this pull request should not conflict with the desktop, Android or iOS clients;
OC-Total-Length
is taken into account when provided in the MOVE operation, but if it is not given the verification is simply skipped.