From 94a7f2e8fbe028ac0e76df214279242a70b40396 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 10 Oct 2019 14:00:52 -0700 Subject: [PATCH] Replace '#' with '_' in .html filename If you link to the file without escaping the '#', the browser will think it's an anchor inside the page. Easier on everyone to just alter the filename. --- SourceGen/WpfGui/Export.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SourceGen/WpfGui/Export.xaml.cs b/SourceGen/WpfGui/Export.xaml.cs index 3c591f0..96694dd 100644 --- a/SourceGen/WpfGui/Export.xaml.cs +++ b/SourceGen/WpfGui/Export.xaml.cs @@ -312,6 +312,11 @@ namespace SourceGen.WpfGui { private void Finish(string fileFilter, string fileExt) { Debug.Assert(mProjectFileName == Path.GetFileName(mProjectFileName)); string initialName = Path.GetFileNameWithoutExtension(mProjectFileName) + fileExt; + if (GenType == GenerateFileType.Html) { + // Can't link to a file with an unescaped '#' -- the browser will think + // it's an anchor. + initialName = initialName.Replace('#', '_'); + } SaveFileDialog fileDlg = new SaveFileDialog() { Filter = fileFilter + "|" + Res.Strings.FILE_FILTER_ALL,