mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 21:47:04 +08:00
hashlib selection moved to node_helpers
This commit is contained in:
parent
ac835a45e1
commit
a4aeed0593
@ -25,6 +25,7 @@ import mimetypes
|
|||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
import comfy.utils
|
import comfy.utils
|
||||||
import comfy.model_management
|
import comfy.model_management
|
||||||
|
import node_helpers
|
||||||
|
|
||||||
from app.user_manager import UserManager
|
from app.user_manager import UserManager
|
||||||
|
|
||||||
@ -156,11 +157,7 @@ class PromptServer():
|
|||||||
return type_dir, dir_type
|
return type_dir, dir_type
|
||||||
|
|
||||||
def compare_image_hash(filepath, image):
|
def compare_image_hash(filepath, image):
|
||||||
# This eval operation is *safe* because we can only accept certain strings passed in via args.
|
hasher = node_helpers.hasher()
|
||||||
# Because that can only be one of 'md5', 'sha1', 'sha256', or 'sha512' which we already define
|
|
||||||
# in comfy.cli_args as an argument passable to the args and only from a set of options, we can
|
|
||||||
# safely use an eval here, as the eval data is "safe" already.
|
|
||||||
hasher = eval(f"hashlib.{args.duplicate_check_hash_function}")
|
|
||||||
|
|
||||||
# function to compare hashes of two images to see if it already exists, fix to #3465
|
# function to compare hashes of two images to see if it already exists, fix to #3465
|
||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user