fix: close input normalization aliases
This commit is contained in:
@@ -6,7 +6,7 @@ const normalizeAssetBase = (base: string): string => {
|
||||
if (
|
||||
!base.startsWith('/') ||
|
||||
base.startsWith('//') ||
|
||||
/[\\%?#]/u.test(base) ||
|
||||
/[\u0000-\u001f\u007f\\%?#]/u.test(base) ||
|
||||
base.split('/').some((segment) => segment === '.' || segment === '..')
|
||||
) {
|
||||
throw new Error('Asset URL base must be a safe absolute path.');
|
||||
|
||||
@@ -208,8 +208,7 @@ const siteConfigSchema = z.object({
|
||||
canonicalUrl: httpUrl,
|
||||
buildId: z.string().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/, 'Build ID must be a safe immutable identifier.'),
|
||||
}).strict().superRefine((site, context) => {
|
||||
const url = new URL(site.canonicalUrl);
|
||||
if (site.environment === 'preview' && (url.hostname !== 'portfolio.localhost' || url.port || url.pathname !== '/')) {
|
||||
if (site.environment === 'preview' && site.canonicalUrl !== 'https://portfolio.localhost/') {
|
||||
context.addIssue({ code: 'custom', message: 'Preview canonical URL must be exactly https://portfolio.localhost/.', path: ['canonicalUrl'] });
|
||||
}
|
||||
if (site.environment === 'production') {
|
||||
|
||||
Reference in New Issue
Block a user