Update channels.js

This commit is contained in:
Aleksandr Statciuk 2022-04-08 22:59:38 +03:00
parent 4c9f78ad09
commit 13d6dd97e3

View file

@ -1,4 +1,5 @@
const Joi = require('joi')
const path = require('path')
module.exports = {
id: Joi.string()
@ -41,5 +42,13 @@ module.exports = {
.uri({
scheme: ['https']
})
.custom((value, helper) => {
const ext = path.extname(value)
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
return true
} else {
return helper.message(`"logo" has an invalid file extension "${ext}"`)
}
})
.allow(null)
}