Comfy-Org / Comfy-Org/ComfyUI

Model asset uploads store digest filenames instead of original filenames

Open
#13,183 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

## Summary

When a model is uploaded through the Assets API, the asset metadata can preserve the original filename, but the actual file written under the model directory is stored as `digest + ext`.

For model assets, this causes a mismatch between:

- asset display / metadata name
- actual filesystem filename used by Comfy model selectors and workflow references

## Current behavior

In `app/assets/services/ingest.py`, `upload_from_temp_path()` computes the digest and writes new files as:

```py
hashed_basename = f"{digest}{ext}"
dest_abs = os.path.abspath(os.path.join(dest_dir, hashed_basename))
```

At the same time, asset metadata keeps a human-readable name via `name` / `client_filename`.

So after uploading a model asset, the database / asset browser can know the original name, but the real file inside `/models/...` is still stored as a hash filename.

## Why this is a problem

This is especially problematic for model assets, because Comfy model dropdowns and workflow references use the actual model filename from the filesystem.

As a result:

- users may see a friendly display name in assets UI
- but nodes / workflow validation still see only the hashed filename
- existing workflows that expect the original filename can no longer resolve the model
- model selectors become much harder to understand because they show content hashes instead of filenames

## Expected behavior

For model assets, the uploaded file should be stored on disk using the original filename (or a conflict-safe variant of it), while the digest remains an internal content hash / dedupe key.

For example:

- keep `asset.hash = blake3:...` for dedupe / identity
- store the file as `OriginalModelName.safetensors`
- if there is a same-directory collision with different content, append a short suffix instead of replacing the filename with the full digest

## Notes

This seems different from display-only improvements such as showing `display_name` in the assets UI. Those help asset browser presentation, but they do not solve the runtime problem that model selectors and workflows rely on the actual on-disk filename.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.