mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
fix(v2): reject routeBasePath: '' (#3377)
* routeBasePath: '' should be forbidden * routeBasePath: '' should be forbidden * commit * try to trigger cla bot
This commit is contained in:
parent
d8cfabb66a
commit
1eb6e13fb7
9 changed files with 33 additions and 24 deletions
|
@ -16,6 +16,7 @@
|
|||
"@types/hapi__joi": "^17.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/utils": "^2.0.0-alpha.62",
|
||||
"@hapi/joi": "17.1.1",
|
||||
"chalk": "^3.0.0"
|
||||
},
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import * as Joi from '@hapi/joi';
|
||||
import {isValidPathname} from '@docusaurus/utils';
|
||||
|
||||
export const PluginIdSchema = Joi.string()
|
||||
.regex(/^[a-zA-Z_\-]+$/)
|
||||
|
@ -39,3 +40,15 @@ export const URISchema = Joi.alternatives(
|
|||
}
|
||||
}),
|
||||
);
|
||||
|
||||
export const PathnameSchema = Joi.string()
|
||||
.custom((val) => {
|
||||
if (!isValidPathname(val)) {
|
||||
throw new Error();
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
})
|
||||
.message(
|
||||
'{{#label}} is not a valid pathname. Pathname should start with / and not contain any domain or query string',
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue