@@ -13,6 +13,23 @@ public sealed record RegistryPlugin
1313 [ JsonPropertyName ( "version" ) ] public string Version { get ; init ; } = "" ;
1414 [ JsonPropertyName ( "description" ) ] public string ? Description { get ; init ; }
1515 [ JsonPropertyName ( "authors" ) ] public string ? Authors { get ; init ; }
16+
17+ // A pinned version that differs from the index's current one: the registry
18+ // keeps every build under dll/<name>-v<ver>.dll, so synthesize the filenames.
19+ public RegistryPlugin WithPinnedVersion ( string ? version )
20+ {
21+ if ( string . IsNullOrWhiteSpace ( version ) ||
22+ version . Equals ( "latest" , StringComparison . OrdinalIgnoreCase ) ||
23+ version . Equals ( Version , StringComparison . OrdinalIgnoreCase ) )
24+ return this ;
25+
26+ return this with
27+ {
28+ Version = version ,
29+ Dll = $ "{ Name } -v{ version } .dll",
30+ Deps = $ "{ Name } -v{ version } -deps.zip",
31+ } ;
32+ }
1633 }
1734
1835 /// <summary>
@@ -39,24 +56,7 @@ public async Task<IReadOnlyList<RegistryPlugin>> FetchIndexAsync(CancellationTok
3956 {
4057 var index = await FetchIndexAsync ( ct ) ;
4158 var entry = index . FirstOrDefault ( p => p . Name . Equals ( name , StringComparison . OrdinalIgnoreCase ) ) ;
42- if ( entry is null )
43- return null ;
44-
45- // A pinned version that differs from the index's current one: the registry
46- // keeps every build under dll/<name>-v<ver>.dll, so synthesize the filenames.
47- if ( ! string . IsNullOrWhiteSpace ( version ) &&
48- ! version . Equals ( "latest" , StringComparison . OrdinalIgnoreCase ) &&
49- ! version . Equals ( entry . Version , StringComparison . OrdinalIgnoreCase ) )
50- {
51- return entry with
52- {
53- Version = version ,
54- Dll = $ "{ entry . Name } -v{ version } .dll",
55- Deps = $ "{ entry . Name } -v{ version } -deps.zip",
56- } ;
57- }
58-
59- return entry ;
59+ return entry ? . WithPinnedVersion ( version ) ;
6060 }
6161
6262 public Task < byte [ ] > DownloadArtifactAsync ( string file , CancellationToken ct = default ) =>
0 commit comments