Skip to content

Commit

Permalink
fix: do not hardcode upload chunk sizes (#1158)
Browse files Browse the repository at this point in the history
* fix: do not hardcode upload chunk sizes

* chore: changeset

* urls is not a list but an object 🤦

---------

Co-authored-by: Alberto G. Jácome <[email protected]>
  • Loading branch information
SamuelAlev and agjacome authored Nov 22, 2024
1 parent 17eb433 commit 8937b15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wet-waves-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frontify/app-bridge": patch
---

fix: do not hardcode upload chunk sizes
2 changes: 1 addition & 1 deletion packages/app-bridge/src/workers/upload.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ function processFile(index, file, fileMetadata) {

progress[index] = [];
const blob = file;
const BYTES_PER_CHUNK = 15 * 1024 * 1024;
const SIZE = blob.size;
const BYTES_PER_CHUNK = Math.ceil(SIZE / Object.keys(fileMetadata.upload.urls).length);
let start = 0;
let end = BYTES_PER_CHUNK;
let chunkNr = 1;
Expand Down

0 comments on commit 8937b15

Please sign in to comment.