From e14355fb69aff897c9a2eb6153c2f3712c4faf81 Mon Sep 17 00:00:00 2001 From: cc Date: Wed, 15 Apr 2026 02:01:15 +0200 Subject: [PATCH] Fix duplicate basePath in version navigation router.push already handles basePath automatically, so using addBasePath or including basePath in pathname caused double /entdb/entdb/ paths. --- src/app/os/bin/page.tsx | 4 +--- src/components/version-switcher.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/os/bin/page.tsx b/src/app/os/bin/page.tsx index 10fc750..e3ff6c0 100644 --- a/src/app/os/bin/page.tsx +++ b/src/app/os/bin/page.tsx @@ -126,9 +126,7 @@ export default function BinaryDetail() { const switchVersion = (versionTag: string) => { router.push( - addBasePath( - `/os/bin?os=${encodeURIComponent(group + "/" + versionTag)}&path=${encodeURIComponent(path!)}` - ) + `/os/bin?os=${encodeURIComponent(group + "/" + versionTag)}&path=${encodeURIComponent(path!)}` ); }; diff --git a/src/components/version-switcher.tsx b/src/components/version-switcher.tsx index 2fd274f..cf54ae2 100644 --- a/src/components/version-switcher.tsx +++ b/src/components/version-switcher.tsx @@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input"; import { ChevronDown, Check } from "lucide-react"; import type { OS } from "@/lib/types"; -import { addBasePath } from "@/lib/env"; +import { addBasePath, basePath } from "@/lib/env"; function compareVersion(a: string, b: string) { const l1 = a.split(".").map(Number); @@ -64,7 +64,9 @@ export function VersionSwitcher({ currentOs }: { currentOs: string }) { const newParams = new URLSearchParams(searchParams.toString()); newParams.set("os", `${group}/${newTag}`); - router.push(`${pathname}?${newParams.toString()}`); + // Strip basePath from pathname since router.push adds it automatically + const pathWithoutBase = pathname.startsWith(basePath) ? pathname.slice(basePath.length) : pathname; + router.push(`${pathWithoutBase}?${newParams.toString()}`); setOpen(false); setFilter(""); };