diff --git a/src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs b/src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs index 51e9d2005c88..4f9ffed3500e 100644 --- a/src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs +++ b/src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs @@ -248,7 +248,7 @@ private LayoutTypes GetDisplayedLayoutType() FolderLayoutModes.CardsView => LayoutTypes.Cards, FolderLayoutModes.GridView => LayoutTypes.Grid, FolderLayoutModes.ColumnView => LayoutTypes.Columns, - _ => throw new InvalidEnumArgumentException(), + _ => LayoutTypes.Details, }; } } diff --git a/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs b/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs index e56090bbb1cc..79c758248a2c 100644 --- a/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs +++ b/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs @@ -293,14 +293,14 @@ await _associatedInstance.FilesystemHelpers.PerformOperationTypeAsync(DataPackag } } - // Dragged data can carry a malformed URI; GetUriAsync throws UriFormatException for it. + // Dragged data can carry a malformed URI or advertise one it can't deliver; GetUriAsync throws for both. private static async Task TryGetUriAsync(DataPackageView dataView) { try { return await dataView.GetUriAsync(); } - catch (UriFormatException) + catch (Exception ex) when (ex is UriFormatException or COMException) { return null; } diff --git a/src/Files.App/ViewModels/UserControls/Previews/MarkdownPreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/MarkdownPreviewViewModel.cs index cc53068f87c8..68f1c686a769 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/MarkdownPreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/MarkdownPreviewViewModel.cs @@ -23,7 +23,12 @@ public MarkdownPreviewViewModel(ListedItem item) public override async Task> LoadPreviewAndDetailsAsync() { var text = await ReadFileAsTextAsync(PreviewFile); - TextValue = EscapeRawHtml(text.Left(Constants.PreviewPane.TextCharacterLimit)); + var markdown = EscapeRawHtml(text.Left(Constants.PreviewPane.TextCharacterLimit)); + + // Markdown that Markdig rejects would otherwise throw inside MarkdownTextBlock during layout + Markdig.Markdown.Parse(markdown); + + TextValue = markdown; return []; }