1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-13 07:00:55 +02:00

docs: #15988 follow-up: Use URL constructor to fix Version Switcher URL double slash issue (#16014)

* concat location properties and use URL constructor to fix issues

* remove slashes from old version urls

* remove versions 1.125.0 and 1.125.4 that don't have docs archives
This commit is contained in:
Nicholas Flamy
2025-02-25 10:34:46 -05:00
committed by GitHub
parent 6c64a6dab8
commit 16266c9f5a
2 changed files with 17 additions and 22 deletions

View File

@ -24,10 +24,13 @@ export default function VersionSwitcher(): JSX.Element {
{ label: 'Next', url: 'https://main.preview.immich.app' },
{ label: 'Latest', url: 'https://immich.app' },
...archiveVersions,
];
].map(({ label, url }) => ({
label,
url: new URL(url),
}));
setVersions(allVersions);
const activeVersion = allVersions.find((version) => new URL(version.url).origin === window.location.origin);
const activeVersion = allVersions.find((version) => version.url.origin === window.location.origin);
if (activeVersion) {
setLabel(activeVersion.label);
}
@ -49,7 +52,7 @@ export default function VersionSwitcher(): JSX.Element {
mobile={windowSize === 'mobile'}
items={versions.map(({ label, url }) => ({
label,
to: url + location.pathname + location.hash,
to: new URL(location.pathname + location.search + location.hash, url).href,
target: '_self',
}))}
/>