mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-26 14:09:45 -08: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;
|
||||
|
||||
// convert data to object
|
||||
if (typeof data === "string") {
|
||||
data = JSON.parse(data);
|
||||
if (typeof data === "string" && res.headers["content-type"] !== "application/json") {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
} catch (_) {
|
||||
// Failed to parse as JSON, just process it as a string
|
||||
}
|
||||
}
|
||||
|
||||
let expression = jsonata(this.jsonPath);
|
||||
|
|
Loading…
Reference in a new issue