@@ -48,8 +48,7 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
4848
4949 nameFilter := strings .ToLower (req .GetName ())
5050
51- installedLibs := []* rpc.InstalledLibrary {}
52- res := listLibraries (lm , req .GetUpdatable (), req .GetAll ())
51+ allLibs := listLibraries (lm , req .GetUpdatable (), req .GetAll ())
5352 if f := req .GetFqbn (); f != "" {
5453 fqbn , err := cores .ParseFQBN (req .GetFqbn ())
5554 if err != nil {
@@ -61,15 +60,16 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
6160 }
6261
6362 filteredRes := map [string ]* installedLib {}
64- for _ , lib := range res {
63+ for _ , lib := range allLibs {
6564 if cp := lib .Library .ContainerPlatform ; cp != nil {
6665 if cp != boardPlatform && cp != refBoardPlatform {
6766 // Filter all libraries from extraneous platforms
6867 continue
6968 }
7069 }
71- if latest , has := filteredRes [lib .Library .CanonicalName ]; has {
70+ if latest , has := filteredRes [lib .Library .Name ]; has {
7271 if latest .Library .LocationPriorityFor (boardPlatform , refBoardPlatform ) >= lib .Library .LocationPriorityFor (boardPlatform , refBoardPlatform ) {
72+ // Pick library with the best priority
7373 continue
7474 }
7575 }
@@ -86,17 +86,18 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
8686 f : compatible ,
8787 }
8888
89- filteredRes [lib .Library .CanonicalName ] = lib
89+ filteredRes [lib .Library .Name ] = lib
9090 }
9191
92- res = []* installedLib {}
92+ allLibs = []* installedLib {}
9393 for _ , lib := range filteredRes {
94- res = append (res , lib )
94+ allLibs = append (allLibs , lib )
9595 }
9696 }
9797
98- for _ , lib := range res {
99- if nameFilter != "" && strings .ToLower (lib .Library .CanonicalName ) != nameFilter {
98+ installedLibs := []* rpc.InstalledLibrary {}
99+ for _ , lib := range allLibs {
100+ if nameFilter != "" && strings .ToLower (lib .Library .Name ) != nameFilter {
100101 continue
101102 }
102103 var release * rpc.LibraryRelease
@@ -105,7 +106,7 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
105106 }
106107 rpcLib , err := lib .Library .ToRPCLibrary ()
107108 if err != nil {
108- return nil , & arduino.PermissionDeniedError {Message : tr ("Error getting information for library %s" , lib .Library .CanonicalName ), Cause : err }
109+ return nil , & arduino.PermissionDeniedError {Message : tr ("Error getting information for library %s" , lib .Library .Name ), Cause : err }
109110 }
110111 installedLibs = append (installedLibs , & rpc.InstalledLibrary {
111112 Library : rpcLib ,
0 commit comments