From 94f75b2fbc3ef9226565d02cac24cb26f88d2d70 Mon Sep 17 00:00:00 2001 From: Brodie Davis Date: Thu, 20 Jun 2024 12:05:15 -0400 Subject: [PATCH] invalidate url field for irrelevant monitor types --- server/model/monitor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/model/monitor.js b/server/model/monitor.js index 2c0d6ded7..510d5b760 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1493,6 +1493,12 @@ class Monitor extends BeanModel { if (this.interval < MIN_INTERVAL_SECOND) { throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`); } + + // Ensure URL is set to null for monitor types that don't use it, + // or the URL may be mistakenly used later (e.g., in notifications) + if (![ "http", "keyword", "json-query", "real-browser" ].includes(this.type)) { + this.url = null; + } } /**