mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-21 00:53:45 +08:00
Merge e50a36e05c into ed7c2c6579
This commit is contained in:
commit
437cc2b706
14
server.py
14
server.py
@ -405,11 +405,19 @@ class PromptServer():
|
|||||||
if overwrite is not None and (overwrite == "true" or overwrite == "1"):
|
if overwrite is not None and (overwrite == "true" or overwrite == "1"):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
# Get uploaded file size once
|
||||||
|
image.file.seek(0, 2) # Seek to end
|
||||||
|
uploaded_size = image.file.tell()
|
||||||
|
image.file.seek(0) # Reset to beginning
|
||||||
|
|
||||||
i = 1
|
i = 1
|
||||||
while os.path.exists(filepath):
|
while os.path.exists(filepath):
|
||||||
if compare_image_hash(filepath, image): #compare hash to prevent saving of duplicates with same name, fix for #3465
|
# Quick size comparison first
|
||||||
image_is_duplicate = True
|
existing_size = os.path.getsize(filepath)
|
||||||
break
|
if existing_size == uploaded_size:
|
||||||
|
if compare_image_hash(filepath, image): #compare hash to prevent saving of duplicates with same name, fix for #3465
|
||||||
|
image_is_duplicate = True
|
||||||
|
break
|
||||||
filename = f"{split[0]} ({i}){split[1]}"
|
filename = f"{split[0]} ({i}){split[1]}"
|
||||||
filepath = os.path.join(full_output_folder, filename)
|
filepath = os.path.join(full_output_folder, filename)
|
||||||
i += 1
|
i += 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user