File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/aspnetcore Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -88,21 +88,26 @@ class MicrosoftAspNetCoreComponentsComponent extends Class {
88
88
*
89
89
* An example of a route parameter is `@page "/counter/{id:int}/{other?}/{*rest}"`, from this we're getting the `id`, `other` and `rest` parameters.
90
90
*/
91
+ pragma [ nomagic]
91
92
private string getARouteParameter ( ) {
92
- result = this .getRouteAttributeUrl ( ) .splitAt ( "{" ) .regexpCapture ( "\\*?([^:?}]+)[:?}](.*)" , 1 )
93
+ exists ( string s |
94
+ s = this .getRouteAttributeUrl ( ) .splitAt ( "{" ) .regexpCapture ( "\\*?([^:?}]+)[:?}](.*)" , 1 ) and
95
+ result = s .toLowerCase ( )
96
+ )
93
97
}
94
98
95
99
/** Gets a property attributed with `[Parameter]` attribute. */
96
- Property getAParameterProperty ( ) {
100
+ pragma [ nomagic]
101
+ private Property getAParameterProperty ( string name ) {
97
102
result = this .getAProperty ( ) and
98
- result .getAnAttribute ( ) instanceof MicrosoftAspNetCoreComponentsParameterAttribute
103
+ result .getAnAttribute ( ) instanceof MicrosoftAspNetCoreComponentsParameterAttribute and
104
+ name = result .getName ( ) .toLowerCase ( )
99
105
}
100
106
101
107
/** Gets a property whose value is populated from route parameters. */
102
108
Property getARouteParameterProperty ( ) {
103
- result = this .getAParameterProperty ( ) and
104
- exists ( string urlParamName | urlParamName = this .getARouteParameter ( ) |
105
- result .getName ( ) .toLowerCase ( ) = urlParamName .toLowerCase ( )
109
+ exists ( string name | name = this .getARouteParameter ( ) |
110
+ result = this .getAParameterProperty ( name )
106
111
)
107
112
}
108
113
}
You can’t perform that action at this time.
0 commit comments