fix(export): drop invalid file-name characters from the suggested export name
A workspace at a drive root is named "D:\", which made the suggested file name invalid. Characters that are invalid in a file name on any supported platform are now removed, and a name left empty (a workspace at /) falls back to YKanBan.
This commit is contained in:
1 parent
05a5169129
commit
1ecb48316d
3 files changed
+36
-4
No files matched your search
@@ -181,6 +181,21 @@ public class MarkdownExporterTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("D:\\", "D")]
|
||||
[DataRow("a<b>c|d?e*f\"g", "abcdefg")]
|
||||
[DataRow("/", null)]
|
||||
public void FileNameDropsCharactersThatAreInvalidInFileNames(string workspaceName, string? expectedName)
|
||||
{
|
||||
string fileName = MarkdownExporter.BuildFileName(workspaceName, ExportedAt);
|
||||
|
||||
CultureInfo culture = Resources.Culture ?? CultureInfo.CurrentUICulture;
|
||||
Assert.AreEqual(
|
||||
string.Format(culture, Resources.Export_FileNamePattern, expectedName ?? Resources.App_Name, ExportedAt),
|
||||
fileName);
|
||||
Assert.AreEqual(-1, fileName.IndexOfAny(Path.GetInvalidFileNameChars()));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TagTableCellsEscapePipesAndLineBreaks()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user