Skip to content

Ensure files are actually saved on tauri #281

@Muhammed-Rahif

Description

@Muhammed-Rahif

In the below lines of code users can start saving the file but not successfully complete saving the file (eg: cancelling the save popup).

try {
if (isTauri) await this.saveFileInTauri(saveAs);
else if (typeof showSaveFilePicker != 'undefined') {
await this.saveFileInDesktopBrowser(saveAs);
} else await this.saveFileLegacy();
Notpad.editors.setIsSaved(Notpad.editors.getActive().id, true);
} catch (err) {
console.error(err);
}

In other words, there no validation that the user saved the file successfully, it just assumes, which is not best practice here. Instead it should check the status of saving process and only set Notpad.editors.setIsSaved(Notpad.editors.getActive().id, true); if it was successfully saved to local.

This can't be achieved in web browsers as stated here: https://stackoverflow.com/questions/41334881/detect-when-user-accepts-to-download-a-file

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working, should be fixedpriority: mediumMedium priority issue/pull request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions