mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-29 18:50:39 +00:00
Fix: [JSON-Query] Prevent parsing string-only JSON (#4425)
This commit is contained in:
parent
288cab6dd7
commit
2b8f55194f
1 changed files with 6 additions and 2 deletions
|
@ -578,8 +578,12 @@ class Monitor extends BeanModel {
|
|||
let data = res.data;
|
||||
|
||||
// convert data to object
|
||||
if (typeof data === "string") {
|
||||
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