@@ -85,12 +85,13 @@ class RazorPageClass extends Class {
8585}
8686
8787private class ViewCallJumpNode extends DataFlow:: NonLocalJumpNode {
88- ViewCall vc ;
8988 RazorPageClass rp ;
9089
9190 ViewCallJumpNode ( ) {
92- viewCallRefersToPage ( vc , rp ) and
93- this .asExpr ( ) = vc .getModelArgument ( )
91+ exists ( ViewCall vc |
92+ viewCallRefersToPage ( vc , rp ) and
93+ this .asExpr ( ) = vc .getModelArgument ( )
94+ )
9495 }
9596
9697 override DataFlow:: Node getAJumpSuccessor ( boolean preservesValue ) {
@@ -108,8 +109,11 @@ private predicate viewCallRefersToPage(ViewCall vc, RazorPageClass rp) {
108109 viewCallRefersToPageRelative ( vc , rp )
109110}
110111
112+ bindingset [ path]
113+ private string stripTilde ( string path ) { result = path .regexpReplaceAll ( "^~/" , "/" ) }
114+
111115private predicate viewCallRefersToPageAbsolute ( ViewCall vc , RazorPageClass rp ) {
112- [ "/" , "" ] + vc .getNameArgument ( ) = [ "" , "~" ] + rp .getSourceFilepath ( )
116+ [ "/" , "" ] + stripTilde ( vc .getNameArgument ( ) ) = rp .getSourceFilepath ( )
113117}
114118
115119private predicate viewCallRefersToPageRelative ( ViewCall vc , RazorPageClass rp ) {
@@ -119,7 +123,7 @@ private predicate viewCallRefersToPageRelative(ViewCall vc, RazorPageClass rp) {
119123private predicate matchesViewCallWithIndex ( ViewCall vc , RazorPageClass rp , int i ) {
120124 exists ( RelativeViewCallFilepath fp |
121125 fp .hasViewCallWithIndex ( vc , i ) and
122- fp .getNormalizedPath ( ) = [ "" , "~" ] + rp .getSourceFilepath ( )
126+ fp .getNormalizedPath ( ) = rp .getSourceFilepath ( )
123127 )
124128}
125129
@@ -183,7 +187,7 @@ private class RelativeViewCallFilepath extends NormalizableFilepath {
183187 else sub1 = sub2
184188 ) and
185189 sub0 = sub1 .replaceAll ( "{0}" , vc_ .getActionName ( ) ) and
186- this = sub0
190+ this = stripTilde ( sub0 )
187191 )
188192 }
189193
0 commit comments