From 9b92a3558d78015f4062da08094fa9c3a18075c9 Mon Sep 17 00:00:00 2001
From: You-Sheng Yang <vicamo@gmail.com>
Date: Fri, 22 Mar 2024 00:02:33 +0800
Subject: [PATCH] getFetchUrl: compose url with full service url

actions/checkout maybe used by Gitea, which allows installing the
server instance in a subdirectory to the service root, therefore a full
serviceUrl must be used.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
---
 dist/index.js     | 3 +--
 src/url-helper.ts | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dist/index.js b/dist/index.js
index 35f6780..7c36fc3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2402,8 +2402,7 @@ function getFetchUrl(settings) {
     if (settings.sshKey) {
         return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
     }
-    // "origin" is SCHEME://HOSTNAME[:PORT]
-    return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
+    return `${serviceUrl}/${encodedOwner}/${encodedName}`;
 }
 exports.getFetchUrl = getFetchUrl;
 function getServerUrl(url) {
diff --git a/src/url-helper.ts b/src/url-helper.ts
index 6807b7f..b73ade8 100644
--- a/src/url-helper.ts
+++ b/src/url-helper.ts
@@ -15,8 +15,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
     return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`
   }
 
-  // "origin" is SCHEME://HOSTNAME[:PORT]
-  return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
+  return `${serviceUrl}/${encodedOwner}/${encodedName}`
 }
 
 export function getServerUrl(url?: string): URL {