[22.05] Send composite datasets directly to tusUpload #14191
Merged
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.
Fixes #14125.
If the data contains a file or is a composite dataset, send it directly to tusUpload(), otherwise attempt to handle the pasted content on the client depending on what that pasted content is.
I couldn't figure out a way to handle the parts of a composite dataset on the client depending on what they are. A composite dataset may consist of any combination of a file, a pasted url(s), and pasted non-url content (unlikely, but not impossible). Any files are stored at
data.files
and are already handled by tus - so no problem there. Any non-file items are stored in thedata.targets[0].target.items[0].composite.items
array and are identified as:src=pasted
for non-url pasted content andsrc=url
for url pasted content. I tried iterating over this array and handling each item separately - which, of course, resulted in 3 separate composite datasets. So, I've opted for the simple solution: if it has files or is a composite dataset, don't try to handle pasted content with tus.How to test the changes?
(Select all options that apply)
License