Skip to content

Commit a27cb4b

Browse files
authored
Merge pull request github#6399 from erik-krogh/nunjucks
Approved by esbena
2 parents 2c6977e + f719e0c commit a27cb4b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

javascript/ql/src/DOM/TargetBlank.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ predicate hasDynamicHrefHostAttributeValue(DOM::ElementDefinition elem) {
4343
url.regexpMatch(Templating::getDelimiterMatchingRegexpWithPrefix("[^?#]*")) and
4444
// ... that does not start with a fixed host or a relative path (common formats)
4545
not url.regexpMatch("(?i)((https?:)?//)?[-a-z0-9.]*/.*") and
46-
// .. that is not a call to `url_for` in a Flask application
47-
not url.regexpMatch("\\{\\{\\s*url_for.*")
46+
// .. that is not a call to `url_for` in a Flask / nunjucks application
47+
not url.regexpMatch("\\{\\{\\s*url(_for)?\\(.+\\).*")
4848
)
4949
)
5050
}

javascript/ql/test/query-tests/DOM/TargetBlank/tst.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ function f() {
6262
// OK, Flask application with internal links
6363
<a href="{{url_for('foo.html', 'foo')}}" target="_blank">Example</a>;
6464
<a href="{{ url_for('foo.html', 'foo')}}" target="_blank">Example</a>;
65-
<a href="{{ url_for('foo.html', 'foo')}}" target="_blank">Example</a>;
65+
<a href="{{ url_for('foo.html', 'foo')}}" target="_blank">Example</a>;
66+
67+
// OK, nunjucks template
68+
<a href="{{ url('foo', query={bla}) }}" target="_blank">Example</a>

0 commit comments

Comments
 (0)