mirror of
https://forgejo.mixinet.net/actions/checkout.git
synced 2025-06-15 14:50:45 -06:00
fix: support pathname except ssh
This commit is contained in:
parent
8530928916
commit
5f56636ef8
5 changed files with 27 additions and 12 deletions
|
@ -16,17 +16,23 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
|||
}
|
||||
|
||||
// "origin" is SCHEME://HOSTNAME[:PORT]
|
||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
|
||||
const baseURL = getBaseUrl(serviceUrl.href)
|
||||
return `${baseURL}/${encodedOwner}/${encodedName}`
|
||||
}
|
||||
|
||||
export function getServerUrl(url?: string): URL {
|
||||
let urlValue =
|
||||
const urlValue =
|
||||
url && url.trim().length > 0
|
||||
? url
|
||||
: process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
return new URL(urlValue)
|
||||
}
|
||||
|
||||
export function getBaseUrl(url: string): string {
|
||||
const matcher = url.match(/^[^?]+/)
|
||||
return (matcher && matcher[0].replace(/\/+$/g, '')) || ''
|
||||
}
|
||||
|
||||
export function getServerApiUrl(url?: string): string {
|
||||
let apiUrl = 'https://api.github.com'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue