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 {
8888 *
8989 * An example of a route parameter is `@page "/counter/{id:int}/{other?}/{*rest}"`, from this we're getting the `id`, `other` and `rest` parameters.
9090 */
91+ pragma [ nomagic]
9192 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+ )
9397 }
9498
9599 /** Gets a property attributed with `[Parameter]` attribute. */
96- Property getAParameterProperty ( ) {
100+ pragma [ nomagic]
101+ private Property getAParameterProperty ( string name ) {
97102 result = this .getAProperty ( ) and
98- result .getAnAttribute ( ) instanceof MicrosoftAspNetCoreComponentsParameterAttribute
103+ result .getAnAttribute ( ) instanceof MicrosoftAspNetCoreComponentsParameterAttribute and
104+ name = result .getName ( ) .toLowerCase ( )
99105 }
100106
101107 /** Gets a property whose value is populated from route parameters. */
102108 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 )
106111 )
107112 }
108113}
You can’t perform that action at this time.
0 commit comments