SaveFilePickerAsync is broken on wasm firefox
See original GitHub issueDescribe the bug An error occur whenever I try to call the SaveFilePicker on Firefox because it uses an api that is not supported on that browser.
To Reproduce Steps to reproduce the behavior:
- Have a SaveFilePickerAsync call in your app
- Observe the following error in the console with no dialog:
Expected behavior The SaveFilePickerAsync to work correctly on Firefox.
Desktop (please complete the following information):
- OS: Arch Linux
- Firefox 111.0.1
- Version 11 preview 6
Additional context Essentially, I investigated myself and found this line https://github.com/AvaloniaUI/Avalonia/blob/master/src/Browser/Avalonia.Browser/webapp/modules/storage/storageProvider.ts#L50 which seemed to call a function on the window, but in checking the mdn documention, if you scroll down at the end, it specifically says that Firefox has “No Support”: https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker#browser_compatibility
I currently have issues to test on my end, but the native-file-system-adapter
module does seem to provide a showSaveFilePicker
which could fix this problem. I wonder why this feature was used considering Firefox doesn’t support it.
Issue Analytics
- State:
- Created 5 months ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
@aldelaro5 to save the file in a conventional way, you convert a file into encoded URI, which is later can be downloaded from a fake
<a>
link. See https://stackoverflow.com/questions/35038884/download-file-from-bytes-in-javascript This is probably the best way, if your files aren’t too big (i.e., less than gigabytes).dotnet run
Well, I just tried in Firefox and it just works. At least how it’s expected from polyfil. Probably can you try to find any logs or debug JS code in your browser? Browser devtools are quite powerful. Also Firefox should automatically use readable TypeScript code when you set breakpoints in the browser. Debugging JS from VS/Rider is a pain.