From: martin f. krafft Date: Thu, 24 Aug 2023 13:23:15 +0000 (+1200) Subject: buildmimetree.py: handle image URLs starting with cid: X-Git-Url: https://git.madduck.net/etc/neomutt.git/commitdiff_plain/00a8a4417bbed5a609adb33039f47d711fd0e404 buildmimetree.py: handle image URLs starting with cid: --- diff --git a/.config/neomutt/buildmimetree.py b/.config/neomutt/buildmimetree.py index 97ada97..e2a23a7 100755 --- a/.config/neomutt/buildmimetree.py +++ b/.config/neomutt/buildmimetree.py @@ -266,6 +266,9 @@ def collect_inline_images( ): relparts = [] for path, info in images.items(): + if path.startswith("cid:"): + continue + data = request.urlopen(path) mimetype = data.headers["Content-Type"] @@ -948,6 +951,23 @@ try: assert tree.children[1].path == written[0] assert written[1] == request.urlopen(test_png).read() + def test_converter_tree_inline_image_cid( + self, const1, fake_filewriter + ): + text = f"![inline base64 image](cid:{const1})" + path = pathlib.Path(const1) + tree = convert_markdown_to_html( + text, + path, + filewriter_fn=fake_filewriter, + related_to_html_only=False, + ) + assert len(tree.children) == 2 + assert tree.children[0].cid != const1 + assert tree.children[0].type != "image" + assert tree.children[1].cid != const1 + assert tree.children[1].type != "image" + def test_inline_image_collection( self, test_png, const1, const2, fake_filewriter ):