mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-23 22:39:38 -05:00
Fix: [JSON-Query] Prevent parsing string-only JSON (#4425)
This commit is contained in:
parent
288cab6dd7
commit
2b8f55194f
@ -578,8 +578,12 @@ class Monitor extends BeanModel {
|
|||||||
let data = res.data;
|
let data = res.data;
|
||||||
|
|
||||||
// convert data to object
|
// convert data to object
|
||||||
if (typeof data === "string") {
|
if (typeof data === "string" && res.headers["content-type"] !== "application/json") {
|
||||||
data = JSON.parse(data);
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch (_) {
|
||||||
|
// Failed to parse as JSON, just process it as a string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let expression = jsonata(this.jsonPath);
|
let expression = jsonata(this.jsonPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user