File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/Microsoft.AspNet.WebApi.Versioning/Dispatcher Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1212 using System . Web . Http . Controllers ;
1313 using System . Web . Http . Routing ;
1414 using Versioning ;
15+ using static System . StringComparison ;
1516
1617 sealed class ApiVersionControllerAggregator
1718 {
@@ -100,15 +101,17 @@ IEnumerable<HttpControllerDescriptor> EnumerateDirectRoutes()
100101 }
101102
102103 var template = subroute . Route . RouteTemplate ;
103- var comparer = StringComparer . OrdinalIgnoreCase ;
104104 var controllers = from route in routes
105- where comparer . Equals ( route . RouteTemplate , template )
105+ where RouteTemplatesIntersect ( route . RouteTemplate , template )
106106 from controller in EnumerateControllersInDataTokens ( route . DataTokens )
107107 select controller ;
108108
109109 return controllers . Distinct ( ) ;
110110 }
111111
112+ static bool RouteTemplatesIntersect ( string template1 , string template2 ) =>
113+ template1 . StartsWith ( template2 , OrdinalIgnoreCase ) || template2 . StartsWith ( template1 , OrdinalIgnoreCase ) ;
114+
112115 static IEnumerable < HttpControllerDescriptor > EnumerateControllersInDataTokens ( IDictionary < string , object > dataTokens )
113116 {
114117 Contract . Requires ( dataTokens != null ) ;
You can’t perform that action at this time.
0 commit comments