From d1c0a964a214e861f1106e69c62b1aec1b3d55a9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Aug 2019 09:41:49 +0200 Subject: [PATCH] Relax plugin package.json validation --- server/helpers/custom-validators/plugins.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index b5e32abc2..63af91a44 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts @@ -41,7 +41,11 @@ function isPluginEngineValid (engine: any) { } function isPluginHomepage (value: string) { - return isUrlValid(value) + return exists(value) && (!value || isUrlValid(value)) +} + +function isPluginBugs (value: string) { + return exists(value) && (!value || isUrlValid(value)) } function areStaticDirectoriesValid (staticDirs: any) { @@ -85,7 +89,7 @@ function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginT isPluginEngineValid(packageJSON.engine) && isPluginHomepage(packageJSON.homepage) && exists(packageJSON.author) && - isUrlValid(packageJSON.bugs) && + isPluginBugs(packageJSON.bugs) && (pluginType === PluginType.THEME || isSafePath(packageJSON.library)) && areStaticDirectoriesValid(packageJSON.staticDirs) && areCSSPathsValid(packageJSON.css) && -- 2.25.1