Skip to content

Commit 8293ab7

Browse files
Fix CodeQL warning
1 parent 7628c02 commit 8293ab7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/AspNetCore/OData/src/Asp.Versioning.OData/OData/VersionedODataOptions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public IReadOnlyDictionary<ApiVersion, ODataOptions> Mapping
6363
set
6464
{
6565
mapping = value;
66-
batchMapping = MapBatchPaths( mapping );
66+
batchMapping = MapBatchPaths( mapping, ApiVersionSelector );
6767
}
6868
}
6969

@@ -140,15 +140,17 @@ public virtual bool TryGetValue( HttpContext? context, [NotNullWhen( true )] out
140140
protected virtual bool TryResolveOptions( [NotNullWhen( true )] out ODataOptions? options ) =>
141141
TryGetValue( httpContextAccessor.HttpContext, out options );
142142

143-
private ODataBatchPathMapping MapBatchPaths( IReadOnlyDictionary<ApiVersion, ODataOptions> mapping )
143+
private static ODataBatchPathMapping MapBatchPaths(
144+
IReadOnlyDictionary<ApiVersion, ODataOptions> mapping,
145+
IApiVersionSelector selector )
144146
{
145147
if ( mapping.Count == 0 )
146148
{
147-
return new( capacity: 0, ApiVersionSelector );
149+
return new( capacity: 0, selector );
148150
}
149151

150152
var count = mapping.Values.Sum( value => value.RouteComponents.Count );
151-
var batchMapping = new ODataBatchPathMapping( count, ApiVersionSelector );
153+
var batchMapping = new ODataBatchPathMapping( count, selector );
152154

153155
foreach ( var (version, options) in mapping )
154156
{

0 commit comments

Comments
 (0)