Update http.js fix #122
Some checks are pending
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run

This commit is contained in:
Namhyeon Go 2024-07-20 17:19:50 +09:00 committed by GitHub
parent 4db44324e4
commit 8b5abfe022
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -752,8 +752,9 @@ var HTTPObject = function(engine) {
if (typeof str === "undefined" || str == null) return '';
var str = String(str);
var Lpos = str.indexOf('{');
var Rpos = str.indexOf('}', Lpos + 1);
var L = '{', R = '}';
var Lpos = str.indexOf(L);
var Rpos = str.indexOf(R, Lpos + 1);
var s0 = '',
s1 = [],
s2 = null,
@ -784,12 +785,17 @@ var HTTPObject = function(engine) {
s2 = this.variables[s3];
}
} else {
// fix #122
try {
s2 = JSON.stringify(JSON.parse(L + s3 + R));
} catch (e) {
s2 = s3;
}
}
}
str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1);
Lpos = str.indexOf('{');
Rpos = str.indexOf('}', Lpos + 1);
Lpos = str.indexOf(L);
Rpos = str.indexOf(R, Lpos + 1);
}
return str;