From 52e8d78d022b46b2d45f4fd5f4eeea87b647c099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82?= <47248711+milewskibogumil@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:04:54 +0100 Subject: [PATCH] remove trailing slash validation from source --- apps/sanity/schema/singleTypes/redirects.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/sanity/schema/singleTypes/redirects.tsx b/apps/sanity/schema/singleTypes/redirects.tsx index dc84a68..8753a31 100644 --- a/apps/sanity/schema/singleTypes/redirects.tsx +++ b/apps/sanity/schema/singleTypes/redirects.tsx @@ -12,7 +12,6 @@ type RedirectTypes = { const SlugValidation = (Rule: SlugRule) => Rule.custom((value) => { if (!value || !value.current) return "The value can't be blank"; if (!value.current.startsWith("/")) return "The path must be a relative path (starts with /)"; - if (value.current !== '/' && value.current.endsWith('/')) return 'Source paths must not end with a trailing slash (/)'; return true; }); @@ -221,8 +220,6 @@ export default defineType({ return 'Each redirect must have a "source" property with a string value'; if (!redirect.source.startsWith('/')) return 'Source paths must start with a forward slash (/)'; - if (redirect.source !== '/' && redirect.source.endsWith('/')) - return 'Source paths must not end with a trailing slash (/)'; if (!redirect.destination || typeof redirect.destination !== 'string') return 'Each redirect must have a "destination" property with a string value'; if (!redirect.destination.startsWith('/'))