Merge pull request #5069 from mdmontesinos/dev-test

fix #5058: ensure sequential file and chunk uploads to avoid overload
This commit is contained in:
Shaun Walker 2025-02-06 13:56:35 -05:00 committed by GitHub
commit cec4b339f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -320,7 +320,7 @@ Oqtane.Interop = {
}
let uploadSize = 0;
if (!chunksize) {
if (!chunksize || chunksize < 1) {
chunksize = 1; // 1 MB default
}
@ -336,8 +336,7 @@ Oqtane.Interop = {
progressbar.value = 0;
}
const uploadFiles = Array.from(fileinput.files).map(file => {
const uploadFile = () => {
const uploadFile = (file) => {
const chunkSize = chunksize * (1024 * 1024);
const totalParts = Math.ceil(file.size / chunkSize);
let partCount = 0;
@ -400,11 +399,10 @@ Oqtane.Interop = {
return uploadPart();
};
return uploadFile();
});
try {
await Promise.all(uploadFiles);
for (const file of fileinput.files) {
await uploadFile(file);
}
} catch (error) {
success = false;
}