fix(v2): relax URI validation (#3227)

* relax URI validation

* add regex

* add test

* fix linting error

* fix formatting

* use URL rather than regex
This commit is contained in:
Anshul Goyal 2020-08-08 01:41:19 +05:30 committed by GitHub
parent fe281a8ebe
commit 181a6174c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 44 additions and 7 deletions

View file

@ -6,6 +6,7 @@
*/
const Joi = require('@hapi/joi');
const {URISchema} = require('@docusaurus/utils-validation');
const DEFAULT_COLOR_MODE_CONFIG = {
defaultMode: 'light',
@ -28,7 +29,7 @@ const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
const DefaultNavbarItemSchema = Joi.object({
items: Joi.array().optional().items(Joi.link('...')),
to: Joi.string(),
href: Joi.string().uri(),
href: URISchema,
label: Joi.string(),
position: NavbarItemPosition,
activeBasePath: Joi.string(),
@ -140,7 +141,7 @@ const ColorModeSchema = Joi.object({
const FooterLinkItemSchema = Joi.object({
to: Joi.string(),
href: Joi.string().uri(),
href: URISchema,
html: Joi.string(),
label: Joi.string(),
})