fix(core): normalize slashes for url/baseUrl instead of throwing (#8066)

This commit is contained in:
Joshua Chen 2022-09-08 11:18:26 -04:00 committed by GitHub
parent 73d0ede21a
commit bcae7503ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 16 deletions

View file

@ -69,6 +69,9 @@ export const URISchema = Joi.alternatives(
// This custom validation logic is required notably because Joi does not
// accept paths like /a/b/c ...
Joi.custom((val: unknown, helpers) => {
if (typeof val !== 'string') {
return helpers.error('any.invalid');
}
try {
// eslint-disable-next-line no-new
new URL(String(val));