Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local html file path resolution from the model name #368

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/civitai_file_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,13 @@ def model_from_sent(model_name, content_type):

extensions = ['.pt', '.ckpt', '.pth', '.safetensors', '.th', '.zip', '.vae']

model_file_length = 0
for content_type_item in content_type:
folder = _api.contenttype_folder(content_type_item)
for folder_path, _, files in os.walk(folder, followlinks=True):
for file in files:
if file.startswith(model_name) and file.endswith(tuple(extensions)):
if (not model_file_length or len(file) < model_file_length) and file.startswith(model_name) and file.endswith(tuple(extensions)):
model_file_length = len(file)
model_file = os.path.join(folder_path, file)

if not model_file:
Expand Down