X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fplugins.ts;h=5a4531f72ebdea684bdddcb105276d2c0497639f;hb=c2777c1dfe688c8fab1ef2fed50e360100fa9198;hp=332418b49cc566574546c50052d9d1e6a1895f60;hpb=c10b638c4b52e9766ef68b58849ee0728647988f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index 332418b49..5a4531f72 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts @@ -1,5 +1,5 @@ import { exists, isArray, isSafePath } from './misc' -import * as validator from 'validator' +import validator from 'validator' import { PluginType } from '../../../shared/models/plugins/plugin.type' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' @@ -14,7 +14,7 @@ function isPluginTypeValid (value: any) { function isPluginNameValid (value: string) { return exists(value) && validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) && - validator.matches(value, /^[a-z\-]+$/) + validator.matches(value, /^[a-z-]+$/) } function isNpmPluginNameValid (value: string) { @@ -146,8 +146,8 @@ function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginT } function isLibraryCodeValid (library: any) { - return typeof library.register === 'function' - && typeof library.unregister === 'function' + return typeof library.register === 'function' && + typeof library.unregister === 'function' } export {