summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2013-01-21 11:30:19 -0800
committerYehuda Katz <wycats@gmail.com>2013-01-21 11:30:19 -0800
commita68a5ad5bac069934d0e8293a064ee312b26f7e7 (patch)
treeeb4a421722094a3e9e2b42c2bc6e7158f1ceb10f /lib
parent69d46e008b454139a6fc6077d66541e7b67145f8 (diff)
parent6ab92eee6d3fb4681a72682fadd114b788b2c5fc (diff)
downloadhandlebars.js-a68a5ad5bac069934d0e8293a064ee312b26f7e7.zip
handlebars.js-a68a5ad5bac069934d0e8293a064ee312b26f7e7.tar.gz
handlebars.js-a68a5ad5bac069934d0e8293a064ee312b26f7e7.tar.bz2
Merge pull request #414 from leshill/leading_context_only
Only allow `this` or `..` to lead a path
Diffstat (limited to 'lib')
-rw-r--r--lib/handlebars/compiler/ast.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js
index fd6cdc5..f448523 100644
--- a/lib/handlebars/compiler/ast.js
+++ b/lib/handlebars/compiler/ast.js
@@ -76,8 +76,11 @@ var Handlebars = require('./base');
for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i];
- if(part === "..") { depth++; }
- else if(part === "." || part === "this") { this.isScoped = true; }
+ if (part === ".." || part === "." || part === "this") {
+ if (dig.length > 0) { throw new Handlebars.Exception("Invalid path: " + this.original); }
+ else if (part === "..") { depth++; }
+ else { this.isScoped = true; }
+ }
else { dig.push(part); }
}