Handle domain name in share URL path

Skip domain-like segments (containing dots) when parsing the share path.
e.g., /share/slug/aol.com is treated as /share/slug
      /share/slug/aol.com/events is treated as /share/slug/events

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mike CaoandClaude Opus 4.5 committed 2026-01-28 23:38:07 -08:00
1 parent c9e14f3bce
commit 4e8be724ac
2 files changed
+26 -2

No files matched your search

+13 -1
View File
@@ -39,11 +39,23 @@ const PAGE_COMPONENTS: Record<string, React.ComponentType<{ websiteId: string }>
attribution: AttributionPage,
};
function getSharePath(pathname: string) {
const segments = pathname.split('/');
const firstSegment = segments[3];
// If first segment looks like a domain name, skip it
if (firstSegment?.includes('.')) {
return segments[4];
}
return firstSegment;
}
export function SharePage() {
const share = useShare();
const { setTheme } = useTheme();
const pathname = usePathname();
const path = pathname.split('/')[3];
const path = getSharePath(pathname);
const { websiteId, parameters = {} } = share;
useEffect(() => {