* Fixes #69344: Don't allow empty string for server.basePath config * Remove unused basepath group
This commit is contained in:
parent
36b66a802e
commit
c8608ed810
|
@ -83,6 +83,8 @@ Object {
|
|||
|
||||
exports[`throws if basepath appends a slash 1`] = `"[basePath]: must start with a slash, don't end with one"`;
|
||||
|
||||
exports[`throws if basepath is an empty string 1`] = `"[basePath]: must start with a slash, don't end with one"`;
|
||||
|
||||
exports[`throws if basepath is missing prepended slash 1`] = `"[basePath]: must start with a slash, don't end with one"`;
|
||||
|
||||
exports[`throws if basepath is not specified, but rewriteBasePath is set 1`] = `"cannot use [rewriteBasePath] when [basePath] is not specified"`;
|
||||
|
|
|
@ -78,6 +78,14 @@ test('throws if basepath appends a slash', () => {
|
|||
expect(() => httpSchema.validate(obj)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
|
||||
test('throws if basepath is an empty string', () => {
|
||||
const httpSchema = config.schema;
|
||||
const obj = {
|
||||
basePath: '',
|
||||
};
|
||||
expect(() => httpSchema.validate(obj)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
|
||||
test('throws if basepath is not specified, but rewriteBasePath is set', () => {
|
||||
const httpSchema = config.schema;
|
||||
const obj = {
|
||||
|
|
|
@ -23,7 +23,7 @@ import { hostname } from 'os';
|
|||
import { CspConfigType, CspConfig, ICspConfig } from '../csp';
|
||||
import { SslConfig, sslSchema } from './ssl_config';
|
||||
|
||||
const validBasePathRegex = /(^$|^\/.*[^\/]$)/;
|
||||
const validBasePathRegex = /^\/.*[^\/]$/;
|
||||
const uuidRegexp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||
|
||||
const match = (regex: RegExp, errorMsg: string) => (str: string) =>
|
||||
|
|
Loading…
Reference in a new issue