mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
fix: upload file if it is 0 bytes
This commit is contained in:
parent
6345e21db9
commit
f82099f36e
1 changed files with 5 additions and 2 deletions
|
@ -59,7 +59,10 @@ const Upload = ({
|
|||
|
||||
setFileProgress(1);
|
||||
|
||||
const chunks = Math.ceil(file.size / chunkSize);
|
||||
let chunks = Math.ceil(file.size / chunkSize);
|
||||
|
||||
// If the file is 0 bytes, we still need to upload 1 chunk
|
||||
if (chunks == 0) chunks++;
|
||||
|
||||
for (let chunkIndex = 0; chunkIndex < chunks; chunkIndex++) {
|
||||
const from = chunkIndex * chunkSize;
|
||||
|
@ -78,7 +81,7 @@ const Upload = ({
|
|||
name: file.name,
|
||||
},
|
||||
chunkIndex,
|
||||
Math.ceil(file.size / chunkSize)
|
||||
chunks
|
||||
)
|
||||
.then((response) => {
|
||||
fileId = response.id;
|
||||
|
|
Loading…
Add table
Reference in a new issue