From 00659e98d5bc9d4174a0e31ed3c9252fd21b5ec7 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 25 May 2023 19:22:17 +0300 Subject: [PATCH] Update channels.js --- scripts/db/schemes/channels.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/db/schemes/channels.js b/scripts/db/schemes/channels.js index 419be527..d6c12636 100644 --- a/scripts/db/schemes/channels.js +++ b/scripts/db/schemes/channels.js @@ -1,5 +1,6 @@ const Joi = require('joi').extend(require('@joi/date')) const path = require('path') +const url = require('url') module.exports = { id: Joi.string() @@ -53,7 +54,7 @@ module.exports = { scheme: ['https'] }) .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)) { return true } else {