Skip to content

CivitAI download with token broken #322

@Jinnai

Description

@Jinnai

Describe the bug
Since comfy-cli 1.5.0+ the CivitAI download with token is broken.

To Reproduce

  • install comfy-cli 1.5.1
  • run command comfy --skip-prompt model download --url '{url}' --relative-path 'models/{local_dir}' --filename '{filename}' --set-civitai-api-token '{token}' with any url that requires login
  • Download fails with exception:
DownloadException: Failed to download file.
Unauthorized download (401).
The creator of this asset requires you to be logged in to download it
or you can set a CivitAI API token using `comfy model download
--set-civitai-api-token` or via the `CIVITAI_API_TOKEN` environment variable
Traceback (most recent call last):
  File "/pkg/modal/_runtime/container_io_manager.py", line 778, in handle_input_exception
    yield
  File "/pkg/modal/_container_entrypoint.py", line 243, in run_input_sync
    res = io_context.call_finalized_function()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pkg/modal/_runtime/container_io_manager.py", line 197, in call_finalized_function
    res = self.finalized_function.callable(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/app.py", line 70, in civitai_dl
    subprocess.run(cmd, shell=True, check=True)

(Same exception when setting the token as environment variable CIVITAI_API_TOKEN instead of with --set-civitai-api-token)

Expected behavior
Download completes without error like it does with comfy-cli 1.4.1 or prior.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions