fix: handle Forgejo instances at subpaths

This commit is contained in:
Ansis Māliņš 2026-04-11 12:14:02 +02:00
parent 0c366fd6a8
commit 2cc0dd4921
2 changed files with 4 additions and 2 deletions

3
dist/index.js vendored
View file

@ -2731,7 +2731,8 @@ function getFetchUrl(settings) {
return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
}
// "origin" is SCHEME://HOSTNAME[:PORT]
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
const rootUrl = serviceUrl.origin + serviceUrl.pathname.replace(/\/$/, '');
return `${rootUrl}/${encodedOwner}/${encodedName}`;
}
function getServerUrl(url) {
let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com';

View file

@ -17,7 +17,8 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
}
// "origin" is SCHEME://HOSTNAME[:PORT]
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
const rootUrl = serviceUrl.origin + serviceUrl.pathname.replace(/\/$/, '')
return `${rootUrl}/${encodedOwner}/${encodedName}`
}
export function getServerUrl(url?: string): URL {