Skip to content

Commit 0b2e010

Browse files
Arcitecbigcat88
authored andcommitted
fix: Only set CivitAI headers if the download URL is for CivitAI
The old code was leaking the CivitAI token by passing it to everything we download regardless of what domain we're fetching from.
1 parent 8a3cf7e commit 0b2e010

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

comfy_cli/command/models/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ def download(
214214
else:
215215
hf_api_token = config_manager.get(constants.HF_API_TOKEN_KEY)
216216

217-
if civitai_api_token is not None:
217+
is_civitai_model_url, is_civitai_api_url, model_id, version_id = check_civitai_url(url)
218+
is_huggingface_url, repo_id, hf_filename, hf_folder_name, hf_branch_name = check_huggingface_url(url)
219+
220+
if (is_civitai_model_url or is_civitai_api_url) and civitai_api_token is not None:
218221
headers = {
219222
"Content-Type": "application/json",
220223
"Authorization": f"Bearer {civitai_api_token}",
221224
}
222225

223-
is_civitai_model_url, is_civitai_api_url, model_id, version_id = check_civitai_url(url)
224-
is_huggingface_url, repo_id, hf_filename, hf_folder_name, hf_branch_name = check_huggingface_url(url)
225-
226226
if is_civitai_model_url:
227227
local_filename, url, model_type, basemodel = request_civitai_model_api(model_id, version_id, headers)
228228

0 commit comments

Comments
 (0)