Fix the special char issue

This commit is contained in:
Namhyeon Go 2022-05-03 13:18:39 +09:00 committed by GitHub
parent 180f037d9f
commit 825b250635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -593,37 +593,31 @@ var HTTPObject = function(engine) {
var Lpos = str.indexOf('{'); var Lpos = str.indexOf('{');
var Rpos = str.indexOf('}', Lpos + 1); var Rpos = str.indexOf('}', Lpos + 1);
var s0 = '', s1 = [], s2 = null, s3, s4; var s0 = '', s1 = [], s2 = null, s3, s4;
var regex = /^[\w\-\s]+$/;
while (Lpos > -1 && Rpos > -1) { while (Lpos > -1 && Rpos > -1) {
s0 = str.substring(Lpos + 1, Rpos); s0 = str.substring(Lpos + 1, Rpos);
s2 = '';
s1 = s0.split(' ');
while (s1.length > 0) {
s3 = s1.pop();
if (!regex.test(s0)) { if (s3 in this.variables) {
s2 = '{' + s0 + '}'; switch (typeof(this.variables[s3])) {
} else { case "function":
s1 = s0.split(' '); s2 = this.variables[s3](s2);
while (s1.length > 0) { break;
s3 = s1.pop();
if (s3 in this.variables) { case "object":
switch (typeof(this.variables[s3])) { s4 = this.variables[s3];
case "function": for (var k in s4) s4[k] = this.evaluate(s4[k]);
s2 = this.variables[s3](s2); s2 = s4;
break; break;
case "object": default:
s4 = this.variables[s3]; s2 = this.variables[s3];
for (var k in s4) s4[k] = this.evaluate(s4[k]);
s2 = s4;
break;
default:
s2 = this.variables[s3];
}
} }
} }
} }
str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1); str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1);
Lpos = str.indexOf('{'); Lpos = str.indexOf('{');
Rpos = str.indexOf('}', Lpos + 1); Rpos = str.indexOf('}', Lpos + 1);