refactor: file download controller
This commit is contained in:
@@ -391,6 +391,10 @@ export class FilesController extends AbstractViewController<FilesControllerEvent
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
||||||
addToast({
|
addToast({
|
||||||
@@ -658,7 +662,9 @@ export class FilesController extends AbstractViewController<FilesControllerEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloadFiles = async (files: FileItem[]) => {
|
downloadFiles = async (files: FileItem[]) => {
|
||||||
if (this.platform === Platform.MacDesktop) {
|
// macOS doesn't allow multiple calls to the filepicker at the
|
||||||
|
// same time, so we need to iterate one by one
|
||||||
|
if (this.platform === Platform.MacDesktop || this.platform === Platform.MacWeb) {
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
await this.handleFileAction({
|
await this.handleFileAction({
|
||||||
type: FileItemActionType.DownloadFile,
|
type: FileItemActionType.DownloadFile,
|
||||||
|
|||||||
Reference in New Issue
Block a user