diff --git a/Directory.Packages.props b/Directory.Packages.props index 70b9fbf0..5779bff1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,9 +14,9 @@ - + - + diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d6838a23..b61dd415 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,6 +2,11 @@ ## [Unreleased] +### Changed +* Replace deprecated `System.Net.WebClient` with `System.Net.Http.HttpClient` in the image downloader used by `--saveimages`. Removes the `#nowarn "44"` suppression. +* Bump `Newtonsoft.Json` transitive-dependency pin from 13.0.3 to 13.0.4. +* Bump `System.Memory` transitive-dependency pin from 4.5.5 to 4.6.3.0 + ### Fixed * Fix `Markdown.ToMd` silently dropping `EmbedParagraphs` nodes: the serialiser now delegates to the node's `Render()` method and formats the resulting paragraphs, consistent with the HTML and LaTeX back-ends. * Fix `Markdown.ToMd` dropping link titles in `DirectLink` and `DirectImage` spans. Links with a title attribute (e.g. `[text](url "title")`) now round-trip correctly; without this fix the title was silently discarded on serialisation. diff --git a/src/fsdocs-tool/BuildCommand.fs b/src/fsdocs-tool/BuildCommand.fs index d4f2cc37..92fd4a31 100644 --- a/src/fsdocs-tool/BuildCommand.fs +++ b/src/fsdocs-tool/BuildCommand.fs @@ -8,6 +8,7 @@ open System.Diagnostics open System.IO open System.Globalization open System.Net +open System.Net.Http open System.Reflection open System.Text @@ -29,7 +30,6 @@ open Suave.Filters open Suave.Logging open FSharp.Formatting.Markdown -#nowarn "44" // Obsolete WebClient /// Convert markdown, script and other content into a static site type internal DocContent @@ -48,7 +48,7 @@ type internal DocContent let createImageSaver (rootOutputFolderAsGiven) = // Download images so that they can be embedded - let wc = new WebClient() + let http = new HttpClient() let mutable counter = 0 fun (url: string) -> @@ -65,7 +65,8 @@ type internal DocContent ensureDirectory (sprintf "%s/savedimages" rootOutputFolderAsGiven) printfn "downloading %s --> %s" url fn - wc.DownloadFile(url, fn) + let bytes = http.GetByteArrayAsync(url).GetAwaiter().GetResult() + File.WriteAllBytes(fn, bytes) url2 else url