OS.js
OS.js copied to clipboard
Failure to cancel file upload correctly
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.
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()
}
}