Skip to content

Commit

Permalink
Merge branch 'bugfix/cancel-large-upload' into 'devel'
Browse files Browse the repository at this point in the history
Fix upload after cancelling large uploads

Closes #1194

See merge request sds-dev/sd-connect/swift-browser-ui!234
  • Loading branch information
Hang Le committed Jan 2, 2024
2 parents f446e61 + 822b207 commit 0a46eff
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions swift_browser_ui_frontend/wasm/js/crypt-post-upworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ function createUploadSessionFile(container, path) {

// Encrypt a single chunk of an upload
function encryptChunk(container, path, deChunk) {
if (!uploads[container]) return undefined;
let chunk = Module.ccall(
"encrypt_chunk",
"number",
Expand Down Expand Up @@ -241,7 +242,7 @@ class StreamSlicer{
}

retryChunk(iter) {
this.getChunk(iter).then(async (chunk) => {
this.getChunk(iter).then(async () => {
if (uploads[this.container]) {
let chunk = await this.getChunk(iter);

Expand Down Expand Up @@ -298,12 +299,14 @@ class StreamSlicer{
while (uploadCount > 4) {
await timeout(250);
}
uploadCount++;
postMessage({
eventType: "activeFile",
object: this.file.name,
});
await this.sendChunks();
if (!uploadCancelled) {
uploadCount++;
postMessage({
eventType: "activeFile",
object: this.file.name,
});
await this.sendChunks();
}
}

finishFile() {
Expand Down

0 comments on commit 0a46eff

Please sign in to comment.