fix #5074: generate cancellation token for file upload

This commit is contained in:
David Montesinos
2025-02-07 09:11:52 +01:00
parent fc81bae9b7
commit 0741ce2197
2 changed files with 10 additions and 3 deletions

View File

@ -362,6 +362,8 @@
}
if (restricted == "")
{
CancellationTokenSource tokenSource = new CancellationTokenSource();
try
{
// upload the files
@ -394,7 +396,7 @@
}
// upload files
var success = await interop.UploadFiles(posturl, folder, _guid, SiteState.AntiForgeryToken, jwt, chunksize);
var success = await interop.UploadFiles(posturl, folder, _guid, SiteState.AntiForgeryToken, jwt, chunksize, tokenSource.Token);
// reset progress indicators
if (ShowProgress)
@ -449,6 +451,10 @@
_message = Localizer["Error.File.Upload"];
_messagetype = MessageType.Error;
_uploading = false;
await tokenSource.CancelAsync();
}
finally {
tokenSource.Dispose();
}
}