Update channels.js

This commit is contained in:
Aleksandr Statciuk 2023-05-25 19:22:17 +03:00
parent a4a8c0b688
commit 00659e98d5

View file

@ -1,5 +1,6 @@
const Joi = require('joi').extend(require('@joi/date')) const Joi = require('joi').extend(require('@joi/date'))
const path = require('path') const path = require('path')
const url = require('url')
module.exports = { module.exports = {
id: Joi.string() id: Joi.string()
@ -53,7 +54,7 @@ module.exports = {
scheme: ['https'] scheme: ['https']
}) })
.custom((value, helper) => { .custom((value, helper) => {
const ext = path.extname(path.basename(value)) const ext = path.extname(url.parse(value).pathname)
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) { if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
return true return true
} else { } else {