File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -211,16 +211,20 @@ function checkFile(filePath) {
211
211
var cfIncludeMatches = matchAll ( line , / t e m p l a t e = \" ( [ ^ " ] + ) \" / g) ;
212
212
213
213
// include '$path'; (inside <cfscript>)
214
- var includeMatches = matchAll ( line , / \b i n c l u d e \s [ ' " ] ( [ ^ ' " ] + ) [ ' " ] / g) ;
214
+ var includeMatches = matchAll ( line , / \b i n c l u d e \s [ ' " ] ( . * \. c f m ) [ ' " ] / g) ;
215
215
216
216
cfIncludeMatches . concat ( includeMatches ) . forEach ( function ( includeMatch ) {
217
217
// console.log(includeMatch);
218
218
219
- // Dynamic path (contains #): all we can check is the non-dynamic part
219
+ // Dynamic path (contains # or &): all we can check is the non-dynamic part,
220
+ // wound back to the last slash
220
221
var templatePath = includeMatch [ 1 ] ;
221
222
var hashPos = templatePath . indexOf ( '#' ) ;
222
- if ( hashPos !== - 1 ) {
223
- templatePath = path . dirname ( templatePath . substr ( 0 , hashPos ) ) ;
223
+ var ampersandPos = templatePath . indexOf ( '&' ) ;
224
+ if ( hashPos !== - 1 || ampersandPos !== - 1 ) {
225
+ var searchPos = hashPos !== - 1 ? hashPos : ampersandPos ;
226
+ var lastSlashPos = templatePath . lastIndexOf ( '/' , searchPos ) ;
227
+ templatePath = path . dirname ( templatePath . substr ( 0 , lastSlashPos ) ) ;
224
228
}
225
229
226
230
// Can't work with webroot-virtual paths, e.g. /missing.cfm
You can’t perform that action at this time.
0 commit comments