@@ -59,29 +59,25 @@ def extract_github_host(api_url: str) -> str:
5959 The base GitHub web host URL (e.g., 'https://github.com',
6060 'https://my-ghe.company.com').
6161 """
62- try :
63- parsed_url = urlparse (api_url )
64- scheme = parsed_url .scheme
65- netloc = parsed_url .netloc # This includes the domain and potentially the port
66-
67- # Special case for GitHub.com API
68- if netloc == "api.github.com" :
69- host_domain = "github.com"
70- # Special case for GitHub.com with port (less common but good practice)
71- elif netloc .startswith ("api.github.com:" ):
72- # Remove 'api.' prefix but keep the port
73- host_domain = netloc .replace ("api." , "" , 1 )
74- # General case for GitHub Enterprise (netloc is already the host:port)
75- else :
76- host_domain = netloc
62+ parsed_url = urlparse (api_url )
63+ scheme = parsed_url .scheme
64+ netloc = parsed_url .netloc # This includes the domain and potentially the port
65+
66+ # Special case for GitHub.com API
67+ if netloc == "api.github.com" :
68+ host_domain = "github.com"
69+ # Special case for GitHub.com with port (less common but good practice)
70+ elif netloc .startswith ("api.github.com:" ):
71+ # Remove 'api.' prefix but keep the port
72+ host_domain = netloc .replace ("api." , "" , 1 )
73+ # General case for GitHub Enterprise (netloc is already the host:port)
74+ else :
75+ host_domain = netloc
7776
78- # Reconstruct the host URL
79- host_url = f"{ scheme } ://{ host_domain } "
77+ # Reconstruct the host URL
78+ host_url = f"{ scheme } ://{ host_domain } "
8079
81- return host_url
82- except Exception as e :
83- log .error (f"Error parsing URL { api_url } : { e } " )
84- return ""
80+ return host_url
8581
8682
8783def download_artifact (
0 commit comments