Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix matches the requested behavior and has targeted regression coverage, with only a nonblocking test-metadata nit remaining.
1 open issue
What changed in this PR
Fixes #25671 by preventing the WebAssembly download fallback from duplicating a recognized file extension, aligning it with the existing native-picker path.
Changes:
- Preserves suggested names ending in any allowed extension, using case-insensitive matching.
- Retains first-extension appending when no allowed extension matches.
- Adds four unattended Skia WebAssembly regression cases.
| File | Description |
|---|---|
src/Uno.WinRT/Storage/Pickers/FileSavePicker.wasm.cs |
Checks allowed extensions before appending the default extension. |
src/Uno.UI.RuntimeTests/Windows/Storage/Pickers/Given_FileSavePicker_Download.cs |
Tests extension preservation, including casing and alternate choices. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

GitHub Issue: closes #25671
PR Type:
🐞 Bugfix
What changed? 🚀
When the browser has no File System Access API (Firefox, Safari, Brave and others),
FileSavePickerfalls back to the download picker. That fallback always appended the firstFileTypeChoicesextension toSuggestedFileName, soReport.pdfwith a.pdfchoice was downloaded asReport.pdf.pdf.The download picker now follows the rule that the File System Access API path (
FileSavePicker.ts) and the Android picker already follow: a name that already ends with one of theFileTypeChoicesextensions (case-insensitive) is kept as is, with its own casing. Otherwise the first extension of the first choice is appended, as before.SuggestedFileNameFileTypeChoicesReport.pdf.pdfReport.pdf.pdfReport.pdfReport.PDF.pdfReport.PDF.pdfReport.PDFReport.txt.pdf; Text:.txt,.textReport.txt.pdfReport.txtReport.text.pdf; Text:.txt,.textReport.text.pdfReport.textReport.pdfReport.pdfReport.pdfReport.txt.pdfReport.txt.pdfReport.txt.pdf.pdf<GUID>.pdf<GUID>.pdfA name whose extension none of the choices has (
Report.txtwith only a PDF choice) still gets the first choice's extension appended, as on the File System Access API path and on Android. What the WinUI picker does with such a name isn't documented, so that case is unchanged.When
SuggestedSaveFileis set, the download picker still returns it, unchanged.The new
Given_FileSavePicker_Downloadruntime tests run on Skia WebAssembly only. They pick a file with the download picker and check its name. The picker returns its file without showing anything, so the tests run unattended. I ran them locally (SamplesAppbrowserwasm, headless Chrome). Without the fix, all four cases fail (Report.pdf.pdf,Report.PDF.pdf,Report.txt.pdf,Report.text.pdf). With the fix, all four pass.PR Checklist ✅
Screenshots Compare Test Runresults.