alter getBaseUrl
This commit is contained in:
parent
22fa664db4
commit
7d7d95cfb9
1 changed files with 3 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// "origin" is SCHEME://HOSTNAME[:PORT]
|
// "origin" is SCHEME://HOSTNAME[:PORT]
|
||||||
const baseURL = getBaseUrl(serviceUrl.href)
|
const baseURL = getBaseUrl(serviceUrl)
|
||||||
return `${baseURL}/${encodedOwner}/${encodedName}`
|
return `${baseURL}/${encodedOwner}/${encodedName}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,9 +29,8 @@ export function getServerUrl(url?: string): URL {
|
||||||
return new URL(urlValue)
|
return new URL(urlValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBaseUrl(url: string): string {
|
function getBaseUrl(u: URL) {
|
||||||
const matcher = url.match(/^[^?]+/)
|
return u.protocol + "//" + u.host + u.pathname.replace(/\/+$/g, '');
|
||||||
return (matcher && matcher[0].replace(/\/+$/g, '')) || ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getServerApiUrl(url?: string): string {
|
export function getServerApiUrl(url?: string): string {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue