@@ -553,6 +553,27 @@ async def test_ingestable_image_left_untouched_and_copied(self, tmp_path: Path):
553553 assert any (u .endswith ("/photo.png" ) for u in fake .files ), fake .files
554554 assert any (u .endswith (".image_mappings.json" ) for u in fake .files ), fake .files
555555
556+ async def test_angle_bracket_image_destination_with_spaces_is_ingested (self , tmp_path : Path ):
557+ kb = tmp_path / "kb"
558+ image_dir = kb / "resource name" / "images"
559+ image_dir .mkdir (parents = True )
560+ _write_valid_png (image_dir / "photo.png" )
561+ src = kb / "page.md"
562+ image_ref = "<resource name/images/photo.png>"
563+ src .write_text (f"" , encoding = "utf-8" )
564+
565+ fake = FakeVikingFS ()
566+ with patch .object (BaseParser , "_get_viking_fs" , return_value = fake ):
567+ await MarkdownParser ().parse (
568+ str (src ), enable_link_rewrite = True , link_rewrite_root = str (kb )
569+ )
570+
571+ md = [_decode (c ) for u , c in fake .files .items () if u .endswith (".md" )]
572+ assert md and f"" in md [0 ], fake .files
573+ assert any (u .endswith ("/photo.png" ) for u in fake .files ), fake .files
574+ mapping = [_decode (c ) for u , c in fake .files .items () if u .endswith (".image_mappings.json" )]
575+ assert mapping and image_ref in mapping [0 ], fake .files
576+
556577 async def test_image_outside_base_dir_depth_adjusted (self , tmp_path : Path ):
557578 # The md lives in kb/sub; the image lives in kb/img — outside base_dir
558579 # (= the md's own directory) but inside the import root. #2429 cannot
0 commit comments