mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-05 18:07:03 +08:00
fix workflow embedding w/ unicode characters
This commit is contained in:
parent
c854ba17ed
commit
8602052fdb
@ -271,9 +271,13 @@ class SaveSVGNode:
|
|||||||
]]>
|
]]>
|
||||||
</metadata>
|
</metadata>
|
||||||
"""
|
"""
|
||||||
# Insert metadata after opening svg tag using regex
|
# Insert metadata after opening svg tag using regex with a replacement function
|
||||||
# import re # Already imported at the top
|
def replacement(match):
|
||||||
svg_content = re.sub(r'(<svg[^>]*>)', r'\1\n' + metadata_element, svg_content)
|
# match.group(1) contains the captured <svg> tag
|
||||||
|
return match.group(1) + '\n' + metadata_element
|
||||||
|
|
||||||
|
# Apply the substitution
|
||||||
|
svg_content = re.sub(r'(<svg[^>]*>)', replacement, svg_content, flags=re.UNICODE)
|
||||||
|
|
||||||
# Write the modified SVG to file
|
# Write the modified SVG to file
|
||||||
with open(os.path.join(full_output_folder, file), 'wb') as svg_file:
|
with open(os.path.join(full_output_folder, file), 'wb') as svg_file:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user