@@ -371,11 +371,15 @@ def _get_merged_workflows(
371371 # Handle both dict and list formats
372372 if isinstance (workflows , dict ):
373373 for wf_id , wf_data in workflows .items ():
374+ if not isinstance (wf_data , dict ):
375+ continue
374376 wf_data ["_catalog_name" ] = entry .name
375377 wf_data ["_install_allowed" ] = entry .install_allowed
376378 merged [wf_id ] = wf_data
377379 elif isinstance (workflows , list ):
378380 for wf_data in workflows :
381+ if not isinstance (wf_data , dict ):
382+ continue
379383 wf_id = wf_data .get ("id" , "" )
380384 if wf_id :
381385 wf_data ["_catalog_name" ] = entry .name
@@ -468,7 +472,7 @@ def add_catalog(self, url: str, name: str | None = None) -> None:
468472
469473 config_path .parent .mkdir (parents = True , exist_ok = True )
470474 with open (config_path , "w" , encoding = "utf-8" ) as f :
471- yaml .dump (data , f , default_flow_style = False )
475+ yaml .dump (data , f , default_flow_style = False , sort_keys = False , allow_unicode = True )
472476
473477 def remove_catalog (self , index : int ) -> str :
474478 """Remove a catalog source by index (0-based). Returns the removed name."""
@@ -488,6 +492,6 @@ def remove_catalog(self, index: int) -> str:
488492 data ["catalogs" ] = catalogs
489493
490494 with open (config_path , "w" , encoding = "utf-8" ) as f :
491- yaml .dump (data , f , default_flow_style = False )
495+ yaml .dump (data , f , default_flow_style = False , sort_keys = False , allow_unicode = True )
492496
493497 return removed .get ("name" , f"catalog-{ index + 1 } " )
0 commit comments