MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
423 stars 51 forks source link

Right-Click Save As Changes Extension #2129

Open MatthewJWalters opened 2 years ago

MatthewJWalters commented 2 years ago

Description We have a local html page with links to csv files (also stored locally). If I right-click the link to the csv file the save-as dialog has file extension options as Excel 97-2003 or all files and changes the extension to xls. (The file is saved as csv with an xls extension which then causes a warning when opening in Excel.

Version

Runtime: Evergreen install 97.0.1072.76 Framework: WinForms OS: Win 10 Enterprise 10.0.19042

Repro Steps Right-click a link to a file, select save-as. Expected behaviour - filename matches the link target. 2022-02-02 17_29_51-Window 2022-02-02 17_32_10-Window single_assembly.csv

AB#38086275

champnic commented 2 years ago

Hey @MatthewJWalters - thanks for the bug report! Does it work as expected if you choose All files for the type?

MatthewJWalters commented 2 years ago

Hi, just checked and if I change it to all files the extension remains as xls unless manually changed. Out of interest I've reset the standard csv file association from Excel to Notepad but this didn't have any effect.

champnic commented 2 years ago

I just tried my sample app navigated to this webpage and did "Save link as" on the .csv file you included, and it seems to work fine. Is it perhaps something about the way the link in your screenshot is setup? Are you sure it's a csv file and not an xls?

image
MatthewJWalters commented 2 years ago

Hi, yes - the file attached in the original post is the file the link points to: image image image (In case it makes a difference my app is compiled as 32bit.)

MatthewJWalters commented 2 years ago

(If i just do a single left click the file is automatically downloaded as .xls)

MatthewJWalters commented 2 years ago

Devtools: image (Context menu 'save link as' isn't working when devtools is running, this was a left-click save)

champnic commented 2 years ago

Strange!

If you point your app to this GitHub Issue page and use the link in your original post, does it still convert to .xls? If you go to your file in the browser (Edge and/or Chrome) instead of your app, what's the behavior there?

champnic commented 2 years ago

Can you also check what the MIME type is specified as in the Content-Type header of the Response? What happens if you set type="text/csv" on the link?

MatthewJWalters commented 2 years ago

I'm only getting partial headers in the response in devtools. However, the file is being recognised as csv when i point it at a server rather than my local desktop version. As this is how it will function in production at our customer sites I'm not overly concerned.

If I set the type to text/csv the webview2 and full Edge both still try to use Excel to open it. Firefox id's the file as an Excel type file but offers to open it with the default program (notepad). 2022-02-07 09_18_46-Window 2022-02-07 09_22_41-Window

champnic commented 2 years ago

Thanks for the info! I've added this as a bug on our backlog, but I'm glad your unblocked in the production scenario.