use user-specified domain only when it is non-empty

This commit is contained in:
Yingda Chen
2025-03-13 14:30:08 +08:00
parent 1036316afe
commit 4cade81a35

View File

@@ -316,7 +316,8 @@ class HubApi:
return the endpoint with which the given repo_id exists. return the endpoint with which the given repo_id exists.
if neither exists, throw 404 error if neither exists, throw 404 error
""" """
if MODELSCOPE_DOMAIN in os.environ: s = os.environ.get(MODELSCOPE_DOMAIN)
if s is not None and s.strip() != '':
endpoint = MODELSCOPE_URL_SCHEME + os.getenv(MODELSCOPE_DOMAIN) endpoint = MODELSCOPE_URL_SCHEME + os.getenv(MODELSCOPE_DOMAIN)
try: try:
self.repo_exists(repo_id=repo_id, repo_type=repo_type, endpoint=endpoint, re_raise=True) self.repo_exists(repo_id=repo_id, repo_type=repo_type, endpoint=endpoint, re_raise=True)