This commit is contained in:
Alex Holliday committed 2025-07-22 09:23:26 -07:00
1 parent cb02bb0de7
commit 43ac0174d1
1 file changed
+2 -7
+2 -7
View File
@@ -164,11 +164,7 @@ const createMonitorBodyValidation = joi.object({
.custom((value, helpers) => { .custom((value, helpers) => {
// 1. Standard URLs: must have protocol and pass canParse() // 1. Standard URLs: must have protocol and pass canParse()
if (/^(https?:\/\/)/.test(value)) { if (/^(https?:\/\/)/.test(value)) {
if ( if (typeof URL !== "undefined" && typeof URL.canParse === "function" && URL.canParse(value)) {
typeof URL !== "undefined" &&
typeof URL.canParse === "function" &&
URL.canParse(value)
) {
return value; return value;
} }
// else, it's a malformed URL with protocol // else, it's a malformed URL with protocol
@@ -197,8 +193,7 @@ const createMonitorBodyValidation = joi.object({
.messages({ .messages({
"string.empty": "This field is required.", "string.empty": "This field is required.",
"string.uri": "The URL you provided is not valid.", "string.uri": "The URL you provided is not valid.",
"string.invalidUrl": "string.invalidUrl": "Please enter a valid URL, hostname, or container name (with optional port).",
"Please enter a valid URL, hostname, or container name (with optional port).",
}), }),
ignoreTlsErrors: joi.boolean().default(false), ignoreTlsErrors: joi.boolean().default(false),
port: joi.number(), port: joi.number(),