@@ -85,12 +85,13 @@ class RazorPageClass extends Class {
85
85
}
86
86
87
87
private class ViewCallJumpNode extends DataFlow:: NonLocalJumpNode {
88
- ViewCall vc ;
89
88
RazorPageClass rp ;
90
89
91
90
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
+ )
94
95
}
95
96
96
97
override DataFlow:: Node getAJumpSuccessor ( boolean preservesValue ) {
@@ -108,8 +109,11 @@ private predicate viewCallRefersToPage(ViewCall vc, RazorPageClass rp) {
108
109
viewCallRefersToPageRelative ( vc , rp )
109
110
}
110
111
112
+ bindingset [ path]
113
+ private string stripTilde ( string path ) { result = path .regexpReplaceAll ( "^~/" , "/" ) }
114
+
111
115
private predicate viewCallRefersToPageAbsolute ( ViewCall vc , RazorPageClass rp ) {
112
- [ "/" , "" ] + vc .getNameArgument ( ) = [ "" , "~" ] + rp .getSourceFilepath ( )
116
+ [ "/" , "" ] + stripTilde ( vc .getNameArgument ( ) ) = rp .getSourceFilepath ( )
113
117
}
114
118
115
119
private predicate viewCallRefersToPageRelative ( ViewCall vc , RazorPageClass rp ) {
@@ -119,7 +123,7 @@ private predicate viewCallRefersToPageRelative(ViewCall vc, RazorPageClass rp) {
119
123
private predicate matchesViewCallWithIndex ( ViewCall vc , RazorPageClass rp , int i ) {
120
124
exists ( RelativeViewCallFilepath fp |
121
125
fp .hasViewCallWithIndex ( vc , i ) and
122
- fp .getNormalizedPath ( ) = [ "" , "~" ] + rp .getSourceFilepath ( )
126
+ fp .getNormalizedPath ( ) = rp .getSourceFilepath ( )
123
127
)
124
128
}
125
129
@@ -183,7 +187,7 @@ private class RelativeViewCallFilepath extends NormalizableFilepath {
183
187
else sub1 = sub2
184
188
) and
185
189
sub0 = sub1 .replaceAll ( "{0}" , vc_ .getActionName ( ) ) and
186
- this = sub0
190
+ this = stripTilde ( sub0 )
187
191
)
188
192
}
189
193
0 commit comments