File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,12 @@ private module ServerLess {
6363 private predicate hasServerlessHandler ( File file , string func ) {
6464 exists ( File ymlFile , string handler , string codeURI , string fileName |
6565 hasServerlessHandler ( ymlFile , handler , codeURI ) and
66- // Captures everything right of the dot in `handler`. E.g. if `handler` is "index.foo" then `func` is "foo".
67- func = handler .regexpCapture ( ".*\\.(.*)" , 1 ) and
68- // Captures everything left of the dot in `handler`. E.g. if `handler` is "index.foo" then `fileName` is "index".
69- fileName = handler .regexpCapture ( "([^.]+).*" , 1 )
66+ // Splits a `handler` into two components. The `fileName` to the left of the dot, and the `func` to the right.
67+ // E.g. if `handler` is "index.foo", then `fileName` is "index" and `func` is "foo".
68+ exists ( string pattern | pattern = "(.*)\\.(.*)" |
69+ fileName = handler .regexpCapture ( pattern , 1 ) and
70+ func = handler .regexpCapture ( pattern , 2 )
71+ )
7072 |
7173 file .getAbsolutePath ( ) =
7274 ymlFile .getParentContainer ( ) .getAbsolutePath ( ) + "/" +
You can’t perform that action at this time.
0 commit comments