Correction of badges url in self-hosting configuration with a custom port. Issue 7025 (#7036)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
cnico
2021-09-25 05:19:44 +02:00
committed by GitHub
parent 16813841b7
commit 1f94f8d571

View File

@@ -21,11 +21,11 @@ export function getBaseUrl(): string {
https://img.shields.io/
*/
try {
const { protocol, hostname } = window.location
const { protocol, hostname, port } = window.location
if (['shields.io', 'www.shields.io'].includes(hostname)) {
return 'https://img.shields.io'
}
return `${protocol}//${hostname}`
return `${protocol}//${hostname}:${port}`
} catch (e) {
// server-side rendering
return ''