Fix Wrong badgeUrl repo badge tab when rootPath is not empty (#3033)

Fix #3032
This commit is contained in:
Andy Han 2023-12-27 17:38:27 +08:00 committed by GitHub
parent e575ffe72d
commit 8c4480f281
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,9 +84,10 @@ async function loadBranches() {
const baseUrl = `${window.location.protocol}//${window.location.hostname}${
window.location.port ? `:${window.location.port}` : ''
}${useConfig().rootPath}`;
}`;
const { rootPath } = useConfig();
const badgeUrl = computed(
() => `/api/badges/${repo.value.id}/status.svg${branch.value !== '' ? `?branch=${branch.value}` : ''}`,
() => `${rootPath}/api/badges/${repo.value.id}/status.svg${branch.value !== '' ? `?branch=${branch.value}` : ''}`,
);
const repoUrl = computed(
() => `/repos/${repo.value.id}${branch.value !== '' ? `/branches/${encodeURIComponent(branch.value)}` : ''}`,