Skip to content

Commit d1ef6a1

Browse files
committed
fix: Always use "Content-Type: application/json" when contacting CivitAI
The previous algorithm only applied the correct API Content-Type (JSON) when a token was available. We now always apply the Content-Type, to ensure that we always get the expected responses.
1 parent 7b1a7b7 commit d1ef6a1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

comfy_cli/command/models/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,12 @@ def download(
217217
is_civitai_model_url, is_civitai_api_url, model_id, version_id = check_civitai_url(url)
218218
is_huggingface_url, repo_id, hf_filename, hf_folder_name, hf_branch_name = check_huggingface_url(url)
219219

220-
if (is_civitai_model_url or is_civitai_api_url) and civitai_api_token is not None:
220+
if is_civitai_model_url or is_civitai_api_url:
221221
headers = {
222222
"Content-Type": "application/json",
223-
"Authorization": f"Bearer {civitai_api_token}",
224223
}
224+
if civitai_api_token is not None:
225+
headers["Authorization"] = f"Bearer {civitai_api_token}"
225226

226227
if is_civitai_model_url:
227228
local_filename, url, model_type, basemodel = request_civitai_model_api(model_id, version_id, headers)

0 commit comments

Comments
 (0)