Skip to content

Commit f9421fe

Browse files
rsbhclaude
andauthored
fix: encode slug segments in api/page URL (#68)
Slugs containing & were breaking the query string. Now each segment is encoded with encodeURIComponent before joining. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3ee1722 commit f9421fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/chronicle/src/lib/page-context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function PageProvider({
116116
const fetchPageData = useCallback(async (slug: string[]): Promise<PageData> => {
117117
const apiPath = slug.length === 0
118118
? '/api/page'
119-
: `/api/page?slug=${slug.join(',')}`;
119+
: `/api/page?slug=${slug.map(s => encodeURIComponent(s)).join(',')}`;
120120
const res = await fetch(apiPath);
121121
if (!res.ok) throw new Error(String(res.status));
122122
return res.json();

0 commit comments

Comments
 (0)