diff --git a/scripts/db/schemes/channels.js b/scripts/db/schemes/channels.js index db6b5fd2..2110e595 100644 --- a/scripts/db/schemes/channels.js +++ b/scripts/db/schemes/channels.js @@ -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) }