@@ -457,7 +457,7 @@ characters_to_list(Binary) ->
457457normalize_metadata (Metadata1 ) ->
458458 Metadata2 = maybe_update_with (<<" requirements" >>, fun normalize_requirements /1 , Metadata1 ),
459459 Metadata3 = maybe_update_with (<<" links" >>, fun try_into_map /1 , Metadata2 ),
460- Metadata4 = maybe_update_with (<<" extra" >>, fun try_into_map /1 , Metadata3 ),
460+ Metadata4 = maybe_update_with (<<" extra" >>, fun try_into_nested_map /1 , Metadata3 ),
461461 guess_build_tools (Metadata4 ).
462462
463463% % @private
@@ -665,14 +665,29 @@ try_into_map(List) ->
665665
666666% % @private
667667try_into_map (Fun , Input ) ->
668- case
669- is_list (Input ) andalso
670- lists :all (fun (E ) -> is_tuple (E ) andalso (tuple_size (E ) == 2 ) end , Input )
671- of
668+ case has_map_shape (Input ) of
672669 true -> maps :from_list (lists :map (Fun , Input ));
673670 false -> Input
674671 end .
675672
673+ % % @private
674+ try_into_nested_map (List ) ->
675+ try_into_nested_map (fun (X ) -> X end , List ).
676+
677+ % % @private
678+ try_into_nested_map (Fun , Input ) ->
679+ case has_map_shape (Input ) of
680+ true -> maps :from_list (lists :map (fun ({Key , Value }) ->
681+ Fun ({Key , try_into_nested_map (Fun , Value )})
682+ end , Input ));
683+ false -> Input
684+ end .
685+
686+ % % @private
687+ has_map_shape (Input ) ->
688+ is_list (Input ) andalso
689+ lists :all (fun (E ) -> is_tuple (E ) andalso (tuple_size (E ) == 2 ) end , Input ).
690+
676691% % @private
677692encode_base16 (Binary ) ->
678693 <<X :256 /big -unsigned -integer >> = Binary ,
0 commit comments