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

add_model_folder_path: ensure unique paths by removing duplicates #5998

Conversation

bigcat88
Copy link
Contributor

The changes are small enough not to complicate the code.

Just added a check if such a path value already exists in folder_names_and_paths - then first the old value is deleted and then the new one is added.

Ideally, it would be possible to check whether it is necessary to delete and add at all, but there would be more code, and apparently it will not work faster because of several additional checks and it will become much less readable.

Signed-off-by: bigcat88 <bigcat88@icloud.com>
@comfyanonymous
Copy link
Owner

This is a very confusing way to solve this problem. Can you just not add it at all to the list? I feel like this would be less confusing.

Also if you could add a unit test for your change that would be great.

@bigcat88
Copy link
Contributor Author

Also if you could add a unit test for your change that would be great.

rewritten as you wished and added tests.

Copy link
Collaborator

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these tests! LGTM! @comfyanonymous PTAL

@comfyanonymous comfyanonymous merged commit caf2074 into comfyanonymous:master Dec 13, 2024
7 checks passed
@bigcat88 bigcat88 deleted the fix/do-not-duplicate-folder_names_and_paths branch December 14, 2024 06:49
@bigcat88 bigcat88 restored the fix/do-not-duplicate-folder_names_and_paths branch December 14, 2024 06:49
@bigcat88 bigcat88 deleted the fix/do-not-duplicate-folder_names_and_paths branch December 14, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants