Skip to content

Commit 29f4e52

Browse files
wiseyodaclaude
andcommitted
fix: decode URI-encoded path segments for files with spaces
Next.js catch-all [...path] segments preserve %20 encoding from the URL. File paths in the DB use literal spaces, causing folder scope checks and GitHub API calls to fail on paths like "roadmap docs/README.md". Added decodeURIComponent to both the share viewer and repo viewer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7c00898 commit 29f4e52

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/app/repos/[owner]/[repo]/[...path]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default async function MarkdownViewPage({
5050
if (!session) redirect("/");
5151

5252
const { owner, repo, path: pathSegments } = await params;
53-
const filePath = pathSegments.join("/");
53+
const filePath = pathSegments.map(decodeURIComponent).join("/");
5454
const branch = await getDefaultBranch(session.accessToken, owner, repo);
5555

5656
const fullRepo = `${owner}/${repo}`;

src/app/s/[id]/[...path]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default async function SharedFilePage({
6363
}
6464

6565
const [owner, repo] = share.repo.split("/");
66-
const filePath = pathSegments.join("/");
66+
const filePath = pathSegments.map(decodeURIComponent).join("/");
6767

6868
// For folder shares, verify the path is within the shared folder
6969
if (share.type === "folder" && share.file_path) {

0 commit comments

Comments
 (0)