Skip to content

Commit

Permalink
Restrict loading embeddings from embedding folders.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Oct 27, 2023
1 parent 40963b5 commit 434ce25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion comfy/sd1_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No

valid_file = None
for embed_dir in embedding_directory:
embed_path = os.path.join(embed_dir, embedding_name)
embed_path = os.path.abspath(os.path.join(embed_dir, embedding_name))
embed_dir = os.path.abspath(embed_dir)
try:
if os.path.commonpath((embed_dir, embed_path)) != embed_dir:
continue
except:
continue
if not os.path.isfile(embed_path):
extensions = ['.safetensors', '.pt', '.bin']
for x in extensions:
Expand Down

0 comments on commit 434ce25

Please sign in to comment.