Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: Allow users to redirect to home page in redirects (#3252)
Jaya Krishna Namburu5152cc6a01a6
diff --git a/apps/builder/app/builder/features/project-settings/section-redirects.tsx b/apps/builder/app/builder/features/project-settings/section-redirects.tsxindex 89833e26aa..7a6afe4123 100644--- a/apps/builder/app/builder/features/project-settings/section-redirects.tsx+++ b/apps/builder/app/builder/features/project-settings/section-redirects.tsx@@ -89,6 +89,10 @@ export const SectionRedirects = () => {If the new path doesn't exist, it's not a valid redirect.*/+ if (newPath === "/") {+ return [];+ }+if (newPath.startsWith("/") === true) {if (existingPaths.has(newPath) === false) {return ["This path doesn't exist in the project"];diff --git a/packages/sdk/src/schema/pages.ts b/packages/sdk/src/schema/pages.tsindex 05a8a28d9b..a99b6c12f9 100644--- a/packages/sdk/src/schema/pages.ts+++ b/packages/sdk/src/schema/pages.ts@@ -114,6 +114,11 @@ export type ProjectMeta = z.infer<typeof ProjectMeta>;export const ProjectNewRedirectPath = PagePath.or(z.string().refine((data) => {+ // Users should be able to redirect from any old-path to the home page in the new project.+ if (data === "/") {+ return true;+ }+try {new URL(data);return true;