|
@@ -57,14 +57,14 @@ export const createLink = [
|
|
|
.custom(value => URL.parse(value).host !== env.DEFAULT_DOMAIN)
|
|
.custom(value => URL.parse(value).host !== env.DEFAULT_DOMAIN)
|
|
|
.withMessage(`${env.DEFAULT_DOMAIN} URLs are not allowed.`),
|
|
.withMessage(`${env.DEFAULT_DOMAIN} URLs are not allowed.`),
|
|
|
body("password")
|
|
body("password")
|
|
|
- .optional()
|
|
|
|
|
|
|
+ .optional({ nullable: true })
|
|
|
.custom(checkUser)
|
|
.custom(checkUser)
|
|
|
.withMessage("Only users can use this field.")
|
|
.withMessage("Only users can use this field.")
|
|
|
.isString()
|
|
.isString()
|
|
|
.isLength({ min: 3, max: 64 })
|
|
.isLength({ min: 3, max: 64 })
|
|
|
.withMessage("Password length must be between 3 and 64."),
|
|
.withMessage("Password length must be between 3 and 64."),
|
|
|
body("customurl")
|
|
body("customurl")
|
|
|
- .optional()
|
|
|
|
|
|
|
+ .optional({ nullable: true })
|
|
|
.custom(checkUser)
|
|
.custom(checkUser)
|
|
|
.withMessage("Only users can use this field.")
|
|
.withMessage("Only users can use this field.")
|
|
|
.isString()
|
|
.isString()
|
|
@@ -76,19 +76,19 @@ export const createLink = [
|
|
|
.custom(value => !preservedUrls.some(url => url.toLowerCase() === value))
|
|
.custom(value => !preservedUrls.some(url => url.toLowerCase() === value))
|
|
|
.withMessage("You can't use this custom URL."),
|
|
.withMessage("You can't use this custom URL."),
|
|
|
body("reuse")
|
|
body("reuse")
|
|
|
- .optional()
|
|
|
|
|
|
|
+ .optional({ nullable: true })
|
|
|
.custom(checkUser)
|
|
.custom(checkUser)
|
|
|
.withMessage("Only users can use this field.")
|
|
.withMessage("Only users can use this field.")
|
|
|
.isBoolean()
|
|
.isBoolean()
|
|
|
.withMessage("Reuse must be boolean."),
|
|
.withMessage("Reuse must be boolean."),
|
|
|
body("description")
|
|
body("description")
|
|
|
- .optional()
|
|
|
|
|
|
|
+ .optional({ nullable: true })
|
|
|
.isString()
|
|
.isString()
|
|
|
.trim()
|
|
.trim()
|
|
|
.isLength({ min: 0, max: 2040 })
|
|
.isLength({ min: 0, max: 2040 })
|
|
|
.withMessage("Description length must be between 0 and 2040."),
|
|
.withMessage("Description length must be between 0 and 2040."),
|
|
|
body("domain")
|
|
body("domain")
|
|
|
- .optional()
|
|
|
|
|
|
|
+ .optional({ nullable: true })
|
|
|
.custom(checkUser)
|
|
.custom(checkUser)
|
|
|
.withMessage("Only users can use this field.")
|
|
.withMessage("Only users can use this field.")
|
|
|
.isString()
|
|
.isString()
|