Continue file upload if recordedit hasn't reloaded #2457
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.
The changes in this PR for continuing file upload include tracking details about current upload jobs in case something occurs during upload and the upload is resubmitted and resumed.
The changes include:
rowIdx
,partialUpload
, anduploadKey
to theUploadFileObject
uploadKey
is the key used inlastContiguousChunk
for thisUploadFileObject
md5_base64
, the column name for the file, and therowIdx
of the record in recordedit applastContiguousChunk
values belowrowIdx
is used for generating theuploadKey
partialUpload
set to true if the generateduploadKey
has a matchlastContiguousChunk
map that means a partial upload might exist for the current file being uploadedjobUrl
inlastContiguousChunk
map with thegeneratedUrl
after calculating the checksumjobUrl
contains thegeneratedUrl
, then we can markpartialUpload
to true and resume upload for the storedjobUrl
jobUrl
should be the same as thegeneratedUrl + ';upload/job_hash
lastContiguousChunkRef
to recordedit provider for tracking if partial upload jobs exist after an error occursuploadKey
mentioned above in the form of${file.checksum}_${column.name}_${form_index}
lastChunkIdx
: the numeric index of the last successfully uploaded chunkjobUrl
: the previous job url for a partial upload jobfileSize
: the file size for the file in the previous upload jobuploadVersion
: the version of the file signaling that the job was already completedfileExists
, if there's a partial upload, pass thejobUrl
from the matching entry inlastContiguousChunk
for use if a409
is returned when checking for the filestart
, if there's a partial upload, use thelastChunkIdx
from the matching entry inlastContiguousChunk
to start the upload process fromOther details about the implementation:
partialUpload
exists for the current file being uploaded, we have to take thegeneratedUrl
and split it into parts, url encode those parts, then recombine the parts so we can compare with the storedjobUrl
(which is url encoded by the server during the previous upload job that was not completed)lastContiguousChunk
, we can stop after the firstnull
orundefined
entry is found since we are looking fortrue
values in thechunkTracker
array before the firstnull
/undefined
.These changes resolve step 1 of issue #2379