microsoft / XmlNotepad

XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.
https://microsoft.github.io/XmlNotepad/
MIT License
981 stars 207 forks source link

Transform with XSLT - now also in Downlaod-folder? #234

Closed Pierre-de-la-Verre closed 1 year ago

Pierre-de-la-Verre commented 1 year ago

The transform with XSLT created always a file in the folder I defined. Since a few weeks it also creates a file in "downloads" folder. Bug or feature?

lovettchris commented 1 year ago

I just ran a test with the following steps and I see nothing added to my "downloads" folder, can you provide more detailed steps?

  1. open XML notepad
  2. open Help/Open sample... menu
  3. open Hamlet.xml
  4. Click on XSLT tab

With the winget version the XSLT output shows up in the sample folder which is located in:

C:\Program Files\WindowsApps\43906ChrisLovett.XmlNotepad_2.8.0.64_neutral__hndwmj480pefj\Application\Samples\Hamlet.xml

With the ClickOnce installer the location is:

C:\Users\lovet\AppData\Local\Apps\2.0\OPP4XTHR.NN9\3XPTB1Q4.A62\xmln..tion_d2e0d325f5b08396_0002.0008_8c77c6a9e90b085c\Samples\Hamlet.xml

And with the Standalone Installer the default install location is "C:\Program Files (x86)\LovettSoftware\XmlNotepad\" and so the samples folder is not read/write so the output is written to "C:\Users\lovet\AppData\Local\Temp\Hamlet.htm".

So my guess is you actually installed XML Notepad in your downloads folder perhaps?

Pierre-de-la-Verre commented 1 year ago

It is a problem with CSV-File.

  1. Use your hamlet-example like above
  2. define the output as c:\something\test.csv
  3. click transform

You will get the file twice - in c:\something and in %download"

lovettchris commented 1 year ago

Oh, I see what you mean, it appears the WebView2 component is doing this without my permission because the file type .csv is not a standard "web page format" (like .htm is) it invokes the web browser "download" feature instead of trying to "render" the file. This results in the following popup dialog:

image

Fixing this is interesting, we have some choices:

  1. leave it as is
  2. don't try and render the file at all in the WebView component, and make it go blank to indicate that it is NOT rendering the .csv file. You have to then open the c:\something\test.csv file yourself in some other editor or in Excel.
  3. for everything except ".htm, .html and .xml" we could invoke the operating system "start" command on that file which will try and launch the "associated editor" in this case probably Excel (but not if it is named .exe, .cmd, .py, .js or any other "program" format that might run untrusted code).

What is your preference?

Pierre-de-la-Verre commented 1 year ago

I think "Leave it" is OK. This creates the defined output and the possibility to open it (in download folder).

lovettchris commented 1 year ago

Ok, that's the easiest, thanks :-)