From 2cc0dd492135e54865b1e8272162026f8c3e388e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ansis=20M=C4=81li=C5=86=C5=A1?= Date: Sat, 11 Apr 2026 12:14:02 +0200 Subject: [PATCH] fix: handle Forgejo instances at subpaths --- dist/index.js | 3 ++- src/url-helper.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index fe3f317..1f16df0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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'; diff --git a/src/url-helper.ts b/src/url-helper.ts index 17a0842..28eea28 100644 --- a/src/url-helper.ts +++ b/src/url-helper.ts @@ -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 {