Failure to cancel file upload correctly
maryam4s26 opened this issue · 1 comments
maryam4s26 commented
Hi @andersevenrud
I have a problem.
If I click the cancel button while uploading the file, the file upload dialog closes but the upload process is not completely canceled and the file is finally uploaded.
andersevenrud commented
Sadly, there is no direct HTTP request abort available in the VFS at the moment.
It should be fairly easy to implement though, at least for file uploads.
- The
options
in thewritefile()
function needs to acceptabort: AbortController
- Which is then passed on to the system adapter
writefile()
- Which is again passed on to the HTTP request abstraction
- Then the file manager can trigger the abort on dialog cancel
const aborter = new AbortController()
vfs.writefile({ /* */ }, file, {
abort: aborter
})
// In a dialog callback
(btn) => {
if (btn === 'cancel') {
aborter.abort()
}
}