mirror of
https://github.com/ChiChou/entdb.git
synced 2026-06-10 23:07:47 +02:00
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.
This commit is contained in:
@@ -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!)}`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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("");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user